I have a PHP array that looks like this:
array (size=3)
'CA,Santa Barbara' =>
array (size=2)
'state' => string 'CA' (length=2)
'city' => string 'Santa Barbara' (length=13)
'KS,Andover' =>
array (size=2)
'state' => string 'KS' (length=2)
'city' => string 'Andover' (length=7)
'KS,Wichita' =>
array (size=2)
'state' => string 'KS' (length=2)
'city' => string 'Wichita' (length=7)
I need to return all the array members who have the values:
state => 'KS'
I am needing to get an array back that looks like this:
array (size=2)
'KS,Andover' =>
array (size=2)
'state' => string 'KS' (length=2)
'city' => string 'Andover' (length=7)
'KS,Wichita' =>
array (size=2)
'state' => string 'KS' (length=2)
'city' => string 'Wichita' (length=7)
Is there a PHP array function that does this? I have found array_search() but that only returns the first match. I need ALL matches.