3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = Array ( 0 => Array ( 'ID' => 101, 'Code' => 1075, 'Date' => '2012-03-03 17:13:12.433' ), 1 => Array ( 'ID' => 103, 'Code' => 175, 'Date' => '2012-09-05 20:30:02.217' ), 2 => Array ( 'ID' => 109, 'Code' => 178, 'Date' => '2012-07-05 20:30:02.217' ) ); $array2 = Array ( 0 => Array ( 'Amount' => 1234, 'ID' => 101 ), 1 => Array ( 'Amount' => 1342, 'ID' => 103 ), 2 => Array ( 'Amount' => 0, 'ID' => 0 ) ); $arr2 = array_column($array2, "ID"); $finalArray = array(); foreach($array1 as $arr){ $key = array_search($arr['ID'], $arr2); if($key ===false){ $key = array_search(0, $arr2); } unset($array2[$key]['ID']); $finalArray[] = array_merge($arr,$array2[$key]); } print_r($finalArray);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [ID] => 101 [Code] => 1075 [Date] => 2012-03-03 17:13:12.433 [Amount] => 1234 ) [1] => Array ( [ID] => 103 [Code] => 175 [Date] => 2012-09-05 20:30:02.217 [Amount] => 1342 ) [2] => Array ( [ID] => 109 [Code] => 178 [Date] => 2012-07-05 20:30:02.217 [Amount] => 0 ) )

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:
159.57 ms | 407 KiB | 5 Q