3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arrayName1 = array( '0' => array('name' => 'steve' ,'age' =>51 ) , '1' => array('name' => 'john' ,'age' =>48 ) , ); $arrayName2 = array( '0' => array('name' => 'Steve' ,'place' =>'downtown' ), '1' => array('name' => 'John' ,'place' =>'New York' ), ); $names2 = array_map('strtolower', array_column($arrayName2, 'name')); $output = array(); foreach ($arrayName1 as $array) { $key = array_search($array['name'], $names2); if ($key !== false) { $output[] = $array + $arrayName2[$key]; } else { $output[] = $array; } } print_r($output);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [name] => steve [age] => 51 [place] => downtown ) [1] => Array ( [name] => john [age] => 48 [place] => New York ) )

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:
156.11 ms | 406 KiB | 5 Q