how can i remove "\n" in string in php? -
this question has answer here:
- remove new lines string 15 answers
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
Post a Comment