I am using the PHP code:
$numberNewline = $number . \'\\n\'; fwrite($file, $numberNewline);
to write $number to a file.
For some reason
Use PHP_EOL. PHP_EOL is platform-independent and good approach.
$numberNewline = $number .PHP_EOL; fwrite($file, $numberNewline);
PHP_EOL is cross-platform-compatible(DOS/Mac/Unix).