you may think as the best way to check a string has HTML tags is to check the string after stripping tags:
if( strlen($string) != strlen(strip_tags($string)) ){
echo ‘Contains HTML tags’;
}
But, the best way is to use regular expressions:
if (preg_match(“/([\<])([^\>]{1,})*([\>])/i”, $string )) {
echo ‘Contains HTML tags’;
}