php - line breaks not showing on output? -


for longest time, i've been outputting comments , using function below in order put in line breaks. it's been working great.

echo str_replace(chr(13),"<br />",$com_text); 

however, of late, code has not been working new comments. still functions older comments in database. new being submitted database not being outputted correctly.

no code has changed, i'm aware of. suggestions?

try using echo nl2br($com_text);

or regex looks new lines:

echo preg_replace('/$\r?^/m', '<br />', $com_text); 

Comments

Popular posts from this blog

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -