[resolved] more specific in_array
Posted: Thu Jul 05, 2007 9:23 am
Hi All,
Is it possible to make in_array a little more specific when it is searching for values (and keys if we're not being strict) in an array?
Lets take the following array ($array) for example:
normally
would return true, but how can I specify it only looks in one type of key, for example the 'one' key?
in pseudo code:
is 'apple' in any key named 'one' anywhere in the array
Is it possible to make in_array a little more specific when it is searching for values (and keys if we're not being strict) in an array?
Lets take the following array ($array) for example:
Code: Select all
Array
(
[0] => apple
[1] => banana
[2] => pear
[3] => Array
(
[one] => apple
[two] => tree
[three] => stuff
)
)Code: Select all
in_array('apple',$array);in pseudo code:
is 'apple' in any key named 'one' anywhere in the array