Open existing file "test.txt", and write some new data into it in PHP
Description
The following code shows how to open existing file "test.txt", and write some new data into it.
Example
/*from w ww . j a v a 2 s. c o m*/
<?php
$myfile = fopen("test.txt", "w") or die("Unable to open file!");
$txt = "data\n";
fwrite($myfile, $txt);
$txt = "data\n";
fwrite($myfile, $txt);
fclose($myfile);
?>