3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = array( array("id" => "1","name"=>"John"), array("id" => "2","name"=>"Peter"), array("id" => "3","name"=>"Tom"), array("id" => "12","name"=>"Astro") ); $array2 = array( array("id" => "1","second_name"=>"Lim"), array("id" => "2","second_name"=>"Parker"), array("id" => "3","second_name"=>"PHP") ); $result = array_column($array1, null, 'id'); foreach ($array2 as $row) { $result[$row['id']]['second_name'] = $row['second_name']; } var_export(array_values($result));
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'id' => '1', 'name' => 'John', 'second_name' => 'Lim', ), 1 => array ( 'id' => '2', 'name' => 'Peter', 'second_name' => 'Parker', ), 2 => array ( 'id' => '3', 'name' => 'Tom', 'second_name' => 'PHP', ), 3 => array ( 'id' => '12', 'name' => 'Astro', ), )

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