I\'m using this code to filter a multidimensional array:
$sourceArray = array(
array(\'name\'=>\'banana\', \'color\'=>\'green\'),
PHP 5.2 accepts the name of a callback in the array_filter
function.
function filter($arr)
{
$arrayToCompare = array('type'=>'fruits','has_name'=>'banana', 'has_color'=>'yelow');
return $arr['name'] == $arrayToCompare['has_name']
&& $arr['color'] == $arrayToCompare['has_color'];
}
$filtered = array_filter($masterItems, 'filter');