php Checking if value exists in array of array
Posted
by Mark
on Stack Overflow
See other posts from Stack Overflow
or by Mark
Published on 2010-03-12T21:10:33Z
Indexed on
2010/03/12
21:17 UTC
Read the original article
Hit count: 175
I have an array within an array.
$a = array ( 0 => array ( 'value' => 'America', ), 1 => array ( 'value' => 'England', ), )
How do I check if 'America' exists in the array? The America array could be any key, and there could be any number of subarrays, so a generalized solution please.
Looking on the php manual I see in_array, but that only works for the top layer. so something like in_array("America", $a)
would not work.
Thanks.
© Stack Overflow or respective owner