How do you use the strpos for an array of needles when searching a string? For example:
$find_letters = array('a', 'c', 'd');
$string = 'abcdefg';
if(strpos($string, $find_letters) !== false)
{
echo 'All the letters are found in the string!';
}
Because when using this, it wouldn’t work, it would be good if there was something like this
@Dave an updated snippet from http://www.php.net/manual/en/function.strpos.php#107351
How to use:
will return
true, because ofarray"cheese".Update: Improved code with stop when the first of the needles is found: