I have an array
$array = array (
'pubMessages' =>
array (
0 =>
array (
'msg' => 'Not bad',
'type' => 'warning',
),
1 =>
array (
'msg' => 'Bad',
'type' => 'error',
),
),
);
To remove the sub array having 'type' => 'error', I use bellow code
$key = array_search('error', $array);
unset($array["pubMessages"][$key]);
The key name of the array pubMessages is changed every time, please tell me how to get this key name dynamically? The count of arrays in pubMessages is also variable.