This is simple question but I am a newbie so please forgive my simple question.
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.
Here is some sample code to help explain what I want to do:
/*** a string with tags ***/
$string = "<li><script>!@#$%^&*\n\'#foo</script><br><p /><li />";
/*** sanitize the string ***/
$x = filter_var($string, FILTER_SANITIZE_SPECIAL_CHARS);
echo $x . "<br>\n";
/*** I want this to output <li><script>!@#$%^&*\n\'#foo</script><br><p /><li /> ***/
echo htmlspecialchars_decode($x);
/*** instead it outputs: <li><script>!@#$%^&* \'#foo</script><br><p /><li /> ***/
All ideas will be appreciated. Thanks in advance.