title: how can i remove "\n" in string in php?
body: <p>how to remove "\n" in string?<br>
  I used 3 method bellow ,seams that only the "\s+" works , but I only want to remove \n,not all space ,how to do the job?<br>
  need help, this question had puzzled me for a long time.</p>
  
  <pre><code>$str="&lt;p&gt;
      hello&lt;br&gt;
      world
  &lt;/p&gt;";
  
  //$str=str_replace("\n","",$str);
  $str=preg_replace("@\n@","",$str);
  //$str=preg_replace("@\s+@"," ",$str);  
  echo $str;
  </code></pre>