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
nl2br() outputs as follows:
And I want it to be as follows:
So how do I do this?
echo trim(strtr($myOriginalString, array(“\r\n” => “
“, “\r” => “
“, “\n” => “