How do I make the content of 'data.txt'
1
23
i.e on two lines NOT on one line as 123?
(see php script below write the out)
I am on Windows VISTA, running a WAMP server.
<?php
$fp = fopen('data.txt', 'w');
fwrite($fp, '1');
fwrite($fp, '23');
fclose($fp);
// the content of 'data.txt' is now 123 and not 23!
?>
PHP output to a textfile
Moderator: General Moderators
-
Mark Baker
- Forum Regular
- Posts: 710
- Joined: Thu Oct 30, 2008 6:24 pm
Re: PHP output to a textfile
Write a newline character
Code: Select all
$fp = fopen('data.txt', 'w');
fwrite($fp, '1');
fwrite($fp, PHP_EOL);
fwrite($fp, '23');
fclose($fp);