3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array=[ [ 'id_station'=>2397, 'hour'=>12, 'data'=>['cameraon'=>355654,'cameraoff'=>4532,'camerabroken'=>76745] ], [ 'id_station'=>2399, 'hour'=>14, 'data'=>['cameraon'=>3905466,'cameraoff'=>1672,'camerabroken'=>70780] ] ]; $datas=array_column($array,'data'); foreach(current($datas) as $column=>$data){ $result[$column]=array_sum(array_column($datas,$column)); } $array[]=['id_station'=>'','hour'=>'','data'=>$result]; var_export($array);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'id_station' => 2397, 'hour' => 12, 'data' => array ( 'cameraon' => 355654, 'cameraoff' => 4532, 'camerabroken' => 76745, ), ), 1 => array ( 'id_station' => 2399, 'hour' => 14, 'data' => array ( 'cameraon' => 3905466, 'cameraoff' => 1672, 'camerabroken' => 70780, ), ), 2 => array ( 'id_station' => '', 'hour' => '', 'data' => array ( 'cameraon' => 4261120, 'cameraoff' => 6204, 'camerabroken' => 147525, ), ), )

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:
116.3 ms | 407 KiB | 5 Q