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?
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?
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
Source: https://ru.stackoverflow.com/questions/235863/
All Articles