如何在php数组中搜索(匹配)多个值?

In php we have array_search() to search a value in an array. According to my knowledge it can search only one value at a time. How to search more that one values in an array. Are there any functions to do so.

Thanks

I'm not sure if there is a function for it, but you could do that in a foreach loop quite easily.

<?php

$array('some', 'values', 'here');
$values = array('values', 'to', 'find');

foreach($values as $v) {
  $key = array_search($v, $array):
  if ($key) {
    $new_array[] = $array[$key];
  }
}

?

try this:

$array = array('some', 'values', 'here');
$values = array('values', 'to', 'find');

foreach($values as $v) {
  $key = array_search($v, $array);
  if ($key) {
    $new_array[] = $array[$key];
  }
}