How to Append Content in Text file using PHP

I am going share how to append content in text file using PHP.


$myfile = fopen("text.txt", "a") or die("Unable to open file!");
$txt = "my text 1";
fwrite($myfile, $txt. PHP_EOL);
$txt2 = "my text 2";
fwrite($myfile, $txt2. PHP_EOL);
fclose($myfile)
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments