[ACCEPTED]-How to resolve PHP PHP_EOL issue-php
Accepted answer
Some "fixes":
Use
\r\n
for your line breaks to 5 make Windows happy.Don't use notepad.
PHP_EOL
only 4 represents something per the system it's 3 running on. It cannot possibly simultaneously 2 represent every EOL sequence that each OS 1 uses.
Don't use PHP_EOL
for text-file output.
IIRC it's 2 better to use "\r\n"
for best compatibility.
You 1 can DEFINE
or $var
it if you want.
Use the nl2br()
function:
echo nl2br("your first line\n your second line");
0
You can read text log file to html with 1 line break. This works in Windows and Linux/Unix:
echo str_replace("\n", '<br>', file_get_contents($logfilename));
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.