I need to match all "keywords" in a multidimesional array:
$array = array(
'green' => 'keyword',
'orange',
'keyword',
'black' => array(
'purple' => 'text',
'brown',
'pink' => 'keyword'
),
'white' => array(
'red',
'yellow' => 'keyword',
'blue'
),
'violet',
'gray'
);
Then I would like to access the match results like:
$matches[0][0]
$matches[2]
$matches[3][2]
....
What should I use? I tried with array_filter but doesn't work.. also it might have to be recursive
function findInArray($array){
$array = array_filter($array, function($array){
return ($array == 'keyword');
});
return $array;
}