PHP runs on the server, not the client. PHP doesn't know or care what the user does with the stuff it outputs. All you need to do is generate and output the contents of the file, under a header that tells the browser (assuming it's a browser) that the content is not to be rendered at all (and then the browser will ask the user what it's supposed to do with the content).
The key bit is therefore the headers required. These can be specified with the [man]header[/man] function (where an example (for saving PDF files) is shown on the page; a Content-Type header of "application/octet-stream" will ensure the browser doesn't try and do something else with the content - see also the user notes on that page).