How to create and write text lines to text file in PHP

1 Answer

0 votes
$f = fopen("e:/datefile.txt", "w") or die("Error open file!");
$txt = "PHP\r\n";
fwrite($f, $txt);
$txt = "Programming\r\n";
fwrite($f, $txt);
$txt = "For Web Applications";
fwrite($f, $txt);
fclose($f);

/*
run:

PHP
Programming
For Web Applications

*/

 



answered Dec 3, 2015 by avibootz
edited Dec 5, 2015 by avibootz
...