I’m requesting data from a server and when I echo the response out onto the page there are no line breaks whatsoever, but when I view the page source there are line breaks.
How is this possible? (i.e. How am I seeing line breaks when I view the page source?)
Using the <pre> tags I can get the data to show up with line breaks on the page, but I would like to parse the string separating the lines and I’m trying to understand how to find the line breaks in the string.
Make sense?
Thanks!
You’re not seeing line breaks because HTML doesn’t render line breaks in markup. You specifically have to encode line breaks. The easiest ways is to replace
\r\nwith<br />