you will need to look into filesystem functions, more notable, fread, fwrite, etc....
not likely you will be able to save them on your disk though, since php is server side, you could create a download page with a save as dialog box, then save it somewhere
and another thing, you won't be able to get the actual code on the remote server, just what the browser parses for you, but for output alone, that should be fine
btw what are you looking to do, real life example anywhere
http://www.php.net/filesystem