How can I check if PHP string contents contain any HTML contents?
I'm not good with Regular Expressions so I would like to have a function named "is_html
" to check this. :) thank you!
If you want to test if a string contains a "<something>"
, (which is lazy but can work for you), you can try something like that :
function is_html($string)
{
return preg_match("/<[^<]+>/",$string,$m) != 0;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With