3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myArray = array( 0 => array( 'event' => 'Conference', 'budget' => 3700, ), 1 => array( 'event' => 'Conference', 'budget' => 500, ), 2 => array( 'event' => 'Showroom', 'budget' => 1000, ), 3 => array( 'event' => 'Mission Chez client', 'budget' => 2000, ), 4 => array( 'event' => 'Séminaire', 'budget' => 700, ), 5 => array( 'event' => 'Livraison', 'budget' => 4000, ), 6 => array( 'event' => 'Conference', 'budget' => 334, ), ); $sumArray = array(); foreach ($myArray as $k=>$subArray) { foreach ($subArray as $id=>$value) { $sumArray[$id]+=$value; } } print_r($sumArray);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined array key "event" in /in/CHfSE on line 39 Fatal error: Uncaught TypeError: Unsupported operand types: null + string in /in/CHfSE:39 Stack trace: #0 {main} thrown in /in/CHfSE on line 39
Process exited with code 255.

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:
105.28 ms | 1437 KiB | 4 Q