自作関数名は strpos_array
strposと同じように使える。検索文字が配列であっても、なくても利用できる。
function strpos_array($haystack, $needles) {
    if ( is_array($needles) ) {
        foreach ($needles as $str) {
            if ( is_array($str) ) {
                $pos = strpos_array($haystack, $str);
            } else {
                $pos = strpos($haystack, $str);
            }
            if ($pos !== FALSE) {
                return $pos;
            } else {
                return FALSE;
            }
        }
    } else {
        return strpos($haystack, $needles);
    }
}
 
  
  
  
  