title: split string into array and trim middle?
body: <p>I have a string that is something like this:</p>
  
  <pre><code>$str="
  
  &lt;code&gt;
  
    lol
        test
  
  &lt;/code&gt;
  
  test";
  </code></pre>
  
  <p>I want to trim the text that is within the tags so that I end up with this:</p>
  
  <pre><code>$str="
  
  &lt;code&gt;lol
        test&lt;/code&gt;
  
  test";
  </code></pre>
  
  <p>Is there a way that I can split this out in to a 3 array pieces and so a simple trim() on the text in the middle?</p>
  
  <p>many thanks</p>