I usually store data from a textarea directly to the database as is, then once I retrieve it back into HTML I use that lovely PHP function nl2br() to convert it to HTML
tags.
This works well for most cases until you are passing this data back into javascript where everything has to be on one line!
nl2br()
outputs as follows:
Line one
Line two
And I want it to be as follows:
Line one
Line two
So how do I do this?
echo trim(strtr($myOriginalString, array("\r\n" => "", "\r" => "", "\n" => "")));