how can i remove "\n" in string in php? -


this question has answer here:

how remove "\n" in string?
used 3 method bellow ,seams "\s+" works , want remove \n,not space ,how job?
need help, question had puzzled me long time.

$str="<p>     hello<br>     world </p>";  //$str=str_replace("\n","",$str); $str=preg_replace("@\n@","",$str); //$str=preg_replace("@\s+@"," ",$str);   echo $str; 

this should trick.

$str=str_replace("\r\n","",$str); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -