3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [ ['id'=> 1,'name'=>'John Sena', 'lastname'=>'Jonn'], ['id'=> 2,'name'=>'Rock', 'lastname'=>'Rock Sena'] ]; $array2 = [ ['id'=>1, 'company'=>'Warner Brother'], ['id'=>2, 'company'=>'Metro'],['id'=>'1', 'Address'=>'USA'] ]; foreach ($array2 as $a2) { foreach ($array1 as &$a1) { if ($a2['id'] == $a1['id']) { $a1 = array_merge($a1, $a2); } } } print_r($array1);
Output for git.master_jit, git.master, rfc.property-hooks
Array ( [0] => Array ( [id] => 1 [name] => John Sena [lastname] => Jonn [company] => Warner Brother [Address] => USA ) [1] => Array ( [id] => 2 [name] => Rock [lastname] => Rock Sena [company] => Metro ) )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
113.85 ms | 406 KiB | 5 Q