fwrite php
snippet in php

php write to txt file

user5867


 <?php
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = "John Doe\n";
fwrite($myfile, $txt);
$txt = "Jane Doe\n";
fwrite($myfile, $txt);
fclose($myfile);
?>
 

fwrite php

user5638


<?php

$file = fopen("test.txt","w");

echo fwrite($file,"Hello World. Testing!");

fclose($file);

?>