3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array_a = [ 0 => ['DATE' => '2012-11-28', 'totalCount' => null], 1 => ['DATE' => '2012-11-29', 'totalCount' => null], 2 => ['DATE' => '2012-11-30', 'totalCount' => null], ]; $array_b = [ 0 => ['DATE' => '2012-11-28', 'totalCount' => 30], 2 => ['DATE' => '2012-11-30', 'totalCount' => 40], 12 => ['DATE' => '2012-12-05', 'totalCount' => 50], ]; $result = $array_a; foreach($array_a as $key => $value){ if (array_key_exists($key, $array_b)){ $result[$key] = $array_b[$key]; } else { $result[$key] = $value; } } var_export($result);
Output for git.master, git.master_jit
array ( 0 => array ( 'DATE' => '2012-11-28', 'totalCount' => 30, ), 1 => array ( 'DATE' => '2012-11-29', 'totalCount' => NULL, ), 2 => array ( 'DATE' => '2012-11-30', 'totalCount' => 40, ), )

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:
58.39 ms | 872 KiB | 5 Q