title: Replace tabs and spaces with a single space as well as carriage returns and newlines with a single newline
body: <pre><code>$string = &quot;My    text       has so    much   whitespace    
  
  
  
  
  Plenty of    spaces  and            tabs&quot;;
  
  echo preg_replace(&quot;/\s\s+/&quot;, &quot; &quot;, $string);
  </code></pre>
  <p>I read the PHP's documentation and followed the <code>preg_replace()</code> tutorial, however this code produces:</p>
  <pre><code>My text has so much whitespace Plenty of spaces and tabs
  </code></pre>
  <p>How can I turn it into :</p>
  <pre><code>My text has so much whitespace    
  Plenty of spaces and tabs
  </code></pre>