Basic example :
function escapeHTML($string) { $char_to_delete = array('<', '>', '*', '$', ';'); foreach($char_to_delete as $char) { $string = str_replace( $char, '', $string ); } $string = htmlentities( $string, ENT_HTML5, 'UTF-8'); return $string; }