cakephp - Combining two arrays in to one in cake php -
this array have.
array ( [0] => array ( [fooditem] => array ( [id] => b102 [food_item_title] => prown cocktail [active] => 1 ) [menufooditem] => array ( [menu_id] => 2 ) ) )
i want combine fooditem , menufooditem array 1 following using native php or cake php
array ( [0] => array ( [fooditem] => array ( [id] => b102 [food_item_title] => prown cocktail [active] => 1 [menu_id] => 2 ) ) )
you can using blow code.
$i = 0; foreach($datas $data) { $result[$i]['fooditem'] = $data['fooditem']; $result[$i]['fooditem']['menu_id'] = $data['menufooditem']['menu_id']; $i++; }
Comments
Post a Comment