3v4l.org

run code in 300+ PHP versions simultaneously
<?php $first = [ '01-1970' => 0.00, '03-2019' => 4350.00, '05-2019' => 150.00, '06-2019' => 50.00, ]; $second = [ '03-2019' => 0.00, '04-2019' => 0.00, '06-2019' => 34.83, ]; $result = $first; foreach ($second as $k => $v) { $result[$k] = ($result[$k] ?? 0) + $v; } uksort( $result, fn($a, $b) => preg_replace('/(\d+)-(\d+)/', '$2-$1', $a) <=> preg_replace('/(\d+)-(\d+)/', '$2-$1', $b) ); var_export($result);
Output for git.master_jit, git.master, rfc.property-hooks
array ( '01-1970' => 0.0, '03-2019' => 4350.0, '04-2019' => 0.0, '05-2019' => 150.0, '06-2019' => 84.83, )

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:
18.47 ms | 401 KiB | 8 Q