I have a question I need to find if the value of key in an array is existed in PHP and get the index value of it.
Example I have this array:
Array
(
[0] => Array
(
[restaurant_id] => 1519
[new_lat] => 14.63807
[new_long] => 121.03158
[date_updated] => 2013-11-14 16:40:34
)
[1] => Array
(
[restaurant_id] => 1247
[new_lat] => 14.63877
[new_long] => 121.03265
[date_updated] => 2013-11-14 16:48:41
)
)
I also used this code also:
$key = array_search($data_add['restaurant_id'],$data);
But it doesn't display the searched value
Now I need to fint if restaurant_id '1247' is existed in array? If existed get that index. Meaning get the index 1 because ID 1247 is in index 1.
I used the array_key_exists() but it will find the key not the key value. I hope you can help me thanks.