3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array1 = [ [ 'id' => 1, 'total' => 100, ], [ 'id' => 2, 'total' => 200, ], [ 'id' => 1, 'total' => 300, ], ]; $array2 = [ [ 'id' => 1, 'daily' => 10, ], [ 'id' => 2, 'daily' => 20, ], ]; $result = array(); foreach($array1 as $key => $value){ $result[] = $array1[$key] + $array2[$key]; } print_r($result); ?>
based on gPHlA
Output for 7.0.0 - 7.2.0
Notice: Undefined offset: 2 in /in/vbCGo on line 32 Fatal error: Uncaught Error: Unsupported operand types in /in/vbCGo:32 Stack trace: #0 {main} thrown in /in/vbCGo on line 32
Process exited with code 255.
Output for 5.4.2 - 5.6.28
Notice: Undefined offset: 2 in /in/vbCGo on line 32 Fatal error: Unsupported operand types in /in/vbCGo on line 32
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/vbCGo on line 2
Process exited with code 255.