In this tutorial, We will learn how to check if a string contains HTML tags in PHP. you'll learn PHP to check if the string contains HTML tags. 


Example:

<?php
  
$myString = "Hi Rathorji, <p>This is awesome.</p>, help";
    
if (isHTML($myString)) {
    echo "There is a HTML Tag in String";
}else{
    echo "No HTML Tag in String";
}
    
function isHtml($string)
{
  return preg_match("/<[^<]+>/",$string,$m) != 0;
} 
    
?>


output:

There is a HTML Tag in String