I've got a file that I'm writing to and I cannot get file_put_contents to append the next entry on a new line, even after a newline character. What am I missing? I'm on a windows machine.
$file = 'test.txt'; $message = "test\n\n"; file_put_contents($file, $message, FILE_APPEND);
try
$file = 'test.txt'; $message = "test".PHP_EOL; file_put_contents($file, $message, FILE_APPEND);
or
$file = 'test.txt'; $message = "test\r\n"; file_put_contents($file, $message, FILE_APPEND);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With