I have a multidimensional array like this:
$a=Array
(
Array
(
Array
(
'id' => 1265451,
'num' => 09381554465
),
Array
(
'id' => 1265451,
'num' => 09370777561
),
Array
(
'id' => 1265451,
'num' => 0963665361
),
Array
(
'id' => 1265451,
'num' => 0943256361
),
Array
(
'id' => 1265451,
'num' => 0975956361
),
Array
(
'id' => 1265451,
'num' => 0963516361
),
),
Array
(
Array
(
'id' => 1265451,
'num' => 0133377469
),
Array
(
'id' => 1265451,
'num' => 02156326987
),
Array
(
'id' => 1265451,
'num' => 01399632548
),
),
);
I need to search for a specific number in num
and return the associated id
. I made two attempts, with no success:
This returns null:
$key = array_search(09370777561, $a);
echo ("**The key is: ". $key);
This returns false:
var_dump(in_array(09370777561, $a));
I expected it to return the id 1265451
.
This array contains phone numbers and can be very large.