PHP ent_quotes exception for <br> and <ar>
i am trying to covert HTML to entities using PHP, but i need to except &lt;br&gt; and &lt;a&gt;  tags.

 here's an example of my code

     <?php 
      $string[0] = "<a href='http://hidd3n.tk'>Needs to stay</a> Filler text in between 
     <br><br> <script src='http://malicious.com/'></script> NEEDS to go";
      $string[1] = htmlentities($string[0], ENT_QUOTES, "UTF-8");
     ?>
PHP ent_quotes exception for <br> and <ar>
===

i am trying to covert HTML to entities using PHP, but i need to except &lt;br&gt; and &lt;a&gt;  tags.

 here's an example of my code

     <?php 
      $string[0] = "<a href='http://hidd3n.tk'>Needs to stay</a> Filler text in between 
     <br><br> <script src='http://malicious.com/'></script> NEEDS to go";
      $string[1] = htmlentities($string[0], ENT_QUOTES, "UTF-8");
     ?>