I have below PHP array:
Array (
[0] => Array ( [policy_id] => 1 [category_id] => 5 [limit_amount] => 11.00 [limit_amount2] => 23.00 ),
[1] => Array ( [policy_id] => 1 [category_id] => 7 [limit_amount] => 32.00 [limit_amount2] => 23.00 ),
[2] => Array ( [policy_id] => 1 [category_id] => 4 [limit_amount] => 12.00 [limit_amount2] => 12.00 ) )
Now i want to do two things:
- Want to check if
category_id = 7
exists in this array or not, and if it is there. - then i would like to get that complete array from this multidimensional array,
Example, if category_id = 7
is in array then it should output
Array ([policy_id] => 1 ,
[category_id] => 7 ,
[limit_amount] => 32.00,
[limit_amount2] => 23.00 )
I tried to use in_array(
), but could not get required values,
Thanks for help,