I can’t deal with this. Please help me. This is array:
$arr = array("data" => array(
array("id" => "5451"),
array("id" => "45346346")
));
for example how can i find the key for id 45346346 ?
$key = array_search($arr['data'], 45346346);
I have tried this but its not working.
I’m trying to delete that array line. I’m guessing I can do that with unset($key)
You have an array of array of arrays.
$arr['data']is an array with 2 values. These values are both arrays.array_searchdoesn’t work, as45346346doesn’t match an array.You’d have you cook your own search, something like this:
Then you can do:
$key = find_in_array($arr['data'], 45346346);. This will return 1, the index of the array containing'id' => 45346346inside$arr['data'].DEMO: http://codepad.org/pSxaBT9g