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);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 22
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 22
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/O6Q7p
function name:  (null)
number of ops:  32
compiled vars:  !0 = $array, !1 = $datas, !2 = $data, !3 = $column, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   14     1        INIT_FCALL                                               'array_column'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'data'
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !1, $6
   15     6        INIT_FCALL                                               'current'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $8      
          9      > FE_RESET_R                                       $9      $8, ->22
         10    > > FE_FETCH_R                                       ~10     $9, !2, ->22
         11    >   ASSIGN                                                   !3, ~10
   16    12        INIT_FCALL                                               'array_sum'
         13        INIT_FCALL                                               'array_column'
         14        SEND_VAR                                                 !1
         15        SEND_VAR                                                 !3
         16        DO_ICALL                                         $13     
         17        SEND_VAR                                                 $13
         18        DO_ICALL                                         $14     
         19        ASSIGN_DIM                                               !4, !3
         20        OP_DATA                                                  $14
   15    21      > JMP                                                      ->10
         22    >   FE_FREE                                                  $9
   18    23        INIT_ARRAY                                       ~16     '', 'id_station'
         24        ADD_ARRAY_ELEMENT                                ~16     '', 'hour'
         25        ADD_ARRAY_ELEMENT                                ~16     !4, 'data'
         26        ASSIGN_DIM                                               !0
         27        OP_DATA                                                  ~16
   19    28        INIT_FCALL                                               'var_export'
         29        SEND_VAR                                                 !0
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.53 ms | 1002 KiB | 17 Q