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

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -