check if string exist after a character php code example
Example 1: check if text exists in string php
$a = 'How are you?';
if (strpos($a, 'are') !== false) {
echo 'true';
}
Example 2: check if string contains character php
// this method is new with PHP 8 and above
$haystack = "Damn, I wonder if this string contains a comma.";
if (str_contains($haystack, ",")) {
echo "There is a comma!!";
}