function clear_code($var) { $var = stripslashes($var); $var = htmlentities($var); $var = strip_tags($var); return $var; } 

The function works, but for some reason it beats the encoding. How to fix?

  • What does "encoding" mean? - xEdelweiss 7:26 pm
  • "Sweetheart" - Happy_Cougar

1 answer 1

Set the encoding for the htmlentities function:

 function clear_code($var) { $var = stripslashes($var); $var = htmlentities($var, ENT_COMPAT | ENT_HTML401, 'UTF-8'); $var = strip_tags($var); return $var; } 

Read more: htmlentities