3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $values = array('a'=>1, 'b'=>2, 'c'=>3); $revisions = array('b'=>4, 'c'=>5, 'd'=>6); $fees = array(); foreach(array_keys($values + $revisions) as $key){ if(array_key_exists($key, $values) && array_key_exists($key, $revisions)){ $fees[$key] = $values[$key] + $revisions[$key]; } elseif(array_key_exists($key, $values)){ $fees[$key] = $values[$key]; } elseif(array_key_exists($key, $revisions)){ $fees[$key] = $revisions[$key]; } } print_r($fees);
Output for 4.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [a] => 1 [b] => 6 [c] => 8 [d] => 6 )