title: How do you trim white space on beginning and the end of each new line with PHP or regex
body: <p>How do you trim white space on beginning and the end of each new line with PHP or regex?</p>
  
  <p>For instance,</p>
  
  <pre><code>$text = "similique sunt in culpa qui officia 
  
       deserunt mollitia animi, id est 
  
    laborum et dolorum fuga   
  
  ";
  </code></pre>
  
  <p>Should be,</p>
  
  <pre><code>$text = "similique sunt in culpa qui officia
  
  deserunt mollitia animi, id est
  
  laborum et dolorum fuga
  ";
  </code></pre>