title: Howto encode texts outside the <pre></pre> tag with htmlentities()? (PHP)
body: <p>I'm trying to make my own BBCode parser for my website and I'm looking for a way to "htmlentities()" except the codes inside PRE tags, and the PRE tag itself.</p>
  
  <p>For example:</p>
  
  <pre>&lt;b&gt;Hello world&lt;/b&gt; (outputs &amp;lt;b&amp;gt;Hello world&amp;lt;&amp;gt;)
  &lt;pre&gt;"This must not be converted to HTML entities"&lt;/pre&gt; (outputs &lt;pre&gt;"This must not be converted to HTML entities"&lt;/pre&gt;)</pre>
  
  <p>I really got no idea on how to do this.</p>
  
  <p>Any kind of help would be appreciated :)</p>
  
  <p>Thanks.</p>