Using preg_match()

The preg_match() function will tell you whether a string contains matches of a pattern.

<?php
$str = "Visit codeapka
$pattern = "/codeapka/i";
echo preg_match($pattern, $str); // Outputs 1
?>
Scroll to Top