submitted by: Guest
PHP: write string to file
write string variable to a text file
code snippet:
<?php
// php file example : write string variable to text file
$output="hungry but too lazy to cook.";
$newfile="newfile.txt";
$file = fopen ($newfile, "w");
fwrite($file, $output);
fclose ($file);
?>
notes:
This example creates the new file in the same directory as the script.



