jim jim - 1 year ago 163
PHP Question

file_put_contents and a new line help

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);

Answer Source

how are you viewing the contents of $file? if you're using notepad you can't see \n.