3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( array("x1" => 1, "x2" => 3, "y5" => 9), array("x1" => 3, "x4" => 1, "y5" => 1), array("x1" => 1, "x8" => 5, "a5" => 2), array("x1" => 2, "x10" => 3, "b5" => 5) ); $keys = []; foreach($array as $subarr){ $keys = array_merge($keys, array_keys($subarr)); } foreach(array_unique($keys) as $item){ $res[$item] = array_sum(array_column($array, $item)); } var_dump($res);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 29
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 29
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Branch analysis from position: 13
filename:       /in/WaqlG
function name:  (null)
number of ops:  34
compiled vars:  !0 = $array, !1 = $keys, !2 = $subarr, !3 = $item, !4 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   10     2      > FE_RESET_R                                       $7      !0, ->13
          3    > > FE_FETCH_R                                               $7, !2, ->13
   11     4    >   INIT_FCALL                                               'array_merge'
          5        SEND_VAR                                                 !1
          6        INIT_FCALL                                               'array_keys'
          7        SEND_VAR                                                 !2
          8        DO_ICALL                                         $8      
          9        SEND_VAR                                                 $8
         10        DO_ICALL                                         $9      
         11        ASSIGN                                                   !1, $9
   10    12      > JMP                                                      ->3
         13    >   FE_FREE                                                  $7
   13    14        INIT_FCALL                                               'array_unique'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $11     
         17      > FE_RESET_R                                       $12     $11, ->29
         18    > > FE_FETCH_R                                               $12, !3, ->29
   14    19    >   INIT_FCALL                                               'array_sum'
         20        INIT_FCALL                                               'array_column'
         21        SEND_VAR                                                 !0
         22        SEND_VAR                                                 !3
         23        DO_ICALL                                         $14     
         24        SEND_VAR                                                 $14
         25        DO_ICALL                                         $15     
         26        ASSIGN_DIM                                               !4, !3
         27        OP_DATA                                                  $15
   13    28      > JMP                                                      ->18
         29    >   FE_FREE                                                  $12
   16    30        INIT_FCALL                                               'var_dump'
         31        SEND_VAR                                                 !4
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.04 ms | 1008 KiB | 19 Q