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?

Thanks.

Answers


It's as simple as doing:

echo "\r\n";

(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",$...);


Need Your Help

Delete standard icon in windows form

winforms icons

how to just delete that windows form application icon in the left corner without replacing it with another icon?

How to write a CSS hack for IE 11?

css css-selectors internet-explorer-11 css-hack

How can I hack or write css only for IE 11? I have a website that looks bad in IE 11.I just search here and there but didnt find any solution yet.