title: Reverse FILTER_SANITIZE_SPECIAL_CHARS with PHP
body: <p>This is simple question but I am a newbie so please forgive my simple question. </p>
  
  <p>Is there an easy way to reverse the effects of the FILTER_SANITIZE_SPECIAL_CHARS filter? If not how would you reverse it. Please don't just say regular expressions, actually suggest how. To be clear I am not looking to reverse the string.</p>
  
  <p>Here is some sample code to help explain what I want to do:</p>
  
  <pre><code>/*** a string with tags ***/
  $string = "&lt;li&gt;&lt;script&gt;!@#$%^&amp;*\n\'#foo&lt;/script&gt;&lt;br&gt;&lt;p /&gt;&lt;li /&gt;";
  
  /*** sanitize the string ***/
  $x = filter_var($string, FILTER_SANITIZE_SPECIAL_CHARS);
  echo $x . "&lt;br&gt;\n";
  
  /*** I want this to output &lt;li&gt;&lt;script&gt;!@#$%^&amp;*\n\'#foo&lt;/script&gt;&lt;br&gt;&lt;p /&gt;&lt;li /&gt; ***/
  echo htmlspecialchars_decode($x);
  /*** instead it outputs: &amp;#60;li&amp;#62;&amp;#60;script&amp;#62;!@#$%^&amp;#38;*&amp;#10;\&amp;#39;#foo&amp;#60;/script&amp;#62;&amp;#60;br&amp;#62;&amp;#60;p /&amp;#62;&amp;#60;li /&amp;#62; ***/
  </code></pre>
  
  <p>All ideas will be appreciated. Thanks in advance.</p>