PHP newline not working in text file

后端 未结 7 419
无人共我
无人共我 2021-02-02 08:41

I am using the PHP code:

$numberNewline = $number . \'\\n\';
fwrite($file, $numberNewline);

to write $number to a file.

For some reason

相关标签:
7条回答
  • 2021-02-02 09:13

    '\n' in single quotes is a literal \n.
    "\n" in double quotes is interpreted as a line break.

    http://php.net/manual/en/language.types.string.php

    0 讨论(0)
提交回复
热议问题