php - How to get value from multidimensional array value -
array ( [updatecategories] => array ( [products] => array ( [0] => array ( [cat_id] => 3 [position] => 2 [product_id] => 8 ) [1] => array ( [cat_id] => 4 [position] => 11 [product_id] => 8 ) [2] => array ( [cat_id] => 3 [position] => 4 [product_id] => 39 ) [3] => array ( [cat_id] => 4 [position] => 9 [product_id] => 8 ) [4] => array ( [cat_id] => 3 [position] => 6 [product_id] => 41 ) [5] => array ( [cat_id] => 11 [position] => 7 [product_id] => 8 )
the above array output array need cat_id
of product_id=8
. how can this?
$newarr = array(); foreach( $arr['updatecategories']['products'] $myarr) { if($myarr['product_id'] == 8) $newarr[] = $myarr['cat_id']; }
Comments
Post a Comment