title: How to remove white spaces with php
body: <p>Here is an example of text taken from database and displayed on the page:</p>
  
  <pre><code>Lorem ipsum dolor sit amet,
  consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
  
  Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris etc....
  </code></pre>
  
  <p>What to do to make the text below to looks like </p>
  
  <pre><code>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
  </code></pre>
  
  <p>I'm trying to remove all unnecessary white spaces and new lines. I have tested with trim() end str_replace, but I did not get the result that I want.</p>