Hi Mike,
Without knowing what exactly you are after - this is the best I can give you!
$fhandle = fopen("test.php","w+");
$code = "<?php echo \"My php file. Last updated: ".date("H:i:s")."\"; ?>";
fwrite($fhandle,$code);
fclose($fhandle);
If you were after something else, what is it exactly you want the script to be able to do?