I am trying to avoid the \n and \r values from the mysql table using nl2br as shown below
$profileDetails['address']=nl2br($profileDetails['address']);
But it is not working.
the value in $profileDetails['address']
is "Naduvilachirayil House,\r\nAnaprampal North P.O,\r\nThalavady"
.
But when I check,
echo nl2br("Naduvilachirayil House,\r\nAnaprampal North P.O,\r\nThalavady");
It is working..
nl2br
does not convert the string\n
into a<br>
. It converts new lines into a<br>
. To show the difference:That is to say, the value from your database is a literal
\
character followed by ann
character.\n
only means "new line" when the string is being defined.