arrays - PHP array_search -


is there function accomplish equivalent of array_search $needle array? like, ideal solution:

$needle = array('first', 'second'); $haystack = array('fifth','second','third', 'first');  // returns key 1 in haystack $search = array_search( $needle, $haystack ); 

if no function, other functions accept needles may arrays can use create custom function?

this might build function:

$intersection = array_intersect($needle, $haystack);  if ($intersection) // $haystack has @ least 1 of $needle  if (count($intersection) == count($needle)) // $haystack has every needle 

Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -