I did not ask about How to replace \r & \n with <br/>?
, I need to know how to dump line endings.
I have a script that handles post data incoming from users that fill a form. How can I dump line endings if the data may contain different types of ones (CR, CRLF, LF)?
When using the var_dump
function, it displays something like
string(3) "
"
And the second question: what happens if users have different OS? Will a browser send different types of line endings that are typical for these OS?
` tag whitespace (including newlines) is collapsed when rendering html in the browser. (View source and you will see your newlines are alive and well) – Orangepill Aug 13 '15 at 19:25
` mostly, not CR/LF combinations. Browsers typically send network linebreaks (CRLF). – mario Aug 13 '15 at 19:25