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

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -