Hi all,
This seems like it should be really simple but to me it's not. I have an array in a variable called $numbers. When I run print_r ($numbers) I get the following...
$earchForNumber = '0304';
// Array called $numbers
Array
(
[0] => Array ( [0] => 0219, 0220, 0221, 0222, 0223 )
[1] => Array ( [0] => 0301, 0302, 0303, 0304 )
[2] => Array ( [0] => 1230, 1231, 0101, 0102 )
)
if (in_array($earchForNumber, $numbers)) {echo 'The key is' . $key;}
What I need to do is search for a number within all of the sub arrays and find the key which it belongs to. So if I wanted to find the key for the value of $earchForNumber (0304) it would return a key of 1.
There are tons of posts on stack overflow about this sort of thing but I can't find any that perform this task. I played around with inarray() but couldn't get any joy.
Any ideas?