php - How to merge array in one array under foreach loop -


i have array want merge under foreach loop please provide solution how can it.

array (     [0] => array         (             [id] => 377556             [name] => 8 ball pool ios app - *     ) )  array (     [0] => array         (             [id] => 377555             [name] => test data     ) ) 

i want below result please provide solution how can merge data in 1 array .

array (     [0] => array         (             [id] => 377556             [name] => 8 ball pool ios app - *     )     [1] => array         (             [id] => 377555             [name] => test data     ) ) 

php code demo

<?php $array1=array (     0 => array         (             "id" => 377556,             "name" => "8 ball pool ios app - *"     ) );  $array2=array (     0 => array         (             "id" => 377555,             "name" => "test data"     ) ); $newarray=array($array1,$array2); $result=array(); foreach($newarray $value) {     $result=array_merge($result,$value); } print_r($result); 

output:

array (     [0] => array         (             [id] => 377556             [name] => 8 ball pool ios app - *         )      [1] => array         (             [id] => 377555             [name] => test data         )  ) 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -