PHP echo the equivalent of CR LF of notepad
I need to export some data using PHP and for each line I'm adding a \r\n.
When I open the exported data file that I downloaded, I see that the \r\n is interpreted as [LF] in Notepad.
But the application in the which I open the file doesnt read the [LF] as a new line.
Now if i do a [CR][LF] in notepad, the application can read the [CR][LF] as a new line.
How can I echo the equivalent of [CR][LF] with php?
It's as simple as doing:
(note the double quotes)
do echo PHP_EOL; that way it'll always display the correct linefeed/carriage return combination that's valid for the system you're on, since not all OSes use the same newline convention. (more info PHP global constants)
Probleme Solved : the String was passed in POST parameter. Removing the \r.
Just have to do a str_replace("\n","\r\n",$...);