check if exists in string in php

check if exists in string in php

$a = 'How are you?';

if (strpos($a, 'are') !== false) {
 echo 'true';
}

OR

// returns true if $needle is a substring of $haystack::

function contains($needle, $haystack)
{
 return strpos($haystack, $needle) !== false;
}