3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array('aa'=>10, 'bb'=>2, 'cc'=>5); $b = array('aa'=>1, 'bb'=>20, 'dd'=>11); $c = array('aa'=>3); $d = array('ee'=>5); $arr = [$a,$b,$c,$d]; $keys = array_keys(array_merge($a,$b,$c,$d)); Foreach($keys as $key){ $sums[$key] = array_sum(array_column($arr, $key)); } Var_dump($sums);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 31
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 31
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/ZHtWf
function name:  (null)
number of ops:  36
compiled vars:  !0 = $a, !1 = $b, !2 = $c, !3 = $d, !4 = $arr, !5 = $keys, !6 = $key, !7 = $sums
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, <array>
    6     3        ASSIGN                                                   !3, <array>
    8     4        INIT_ARRAY                                       ~12     !0
          5        ADD_ARRAY_ELEMENT                                ~12     !1
          6        ADD_ARRAY_ELEMENT                                ~12     !2
          7        ADD_ARRAY_ELEMENT                                ~12     !3
          8        ASSIGN                                                   !4, ~12
   10     9        INIT_FCALL                                               'array_keys'
         10        INIT_FCALL                                               'array_merge'
         11        SEND_VAR                                                 !0
         12        SEND_VAR                                                 !1
         13        SEND_VAR                                                 !2
         14        SEND_VAR                                                 !3
         15        DO_ICALL                                         $14     
         16        SEND_VAR                                                 $14
         17        DO_ICALL                                         $15     
         18        ASSIGN                                                   !5, $15
   11    19      > FE_RESET_R                                       $17     !5, ->31
         20    > > FE_FETCH_R                                               $17, !6, ->31
   12    21    >   INIT_FCALL                                               'array_sum'
         22        INIT_FCALL                                               'array_column'
         23        SEND_VAR                                                 !4
         24        SEND_VAR                                                 !6
         25        DO_ICALL                                         $19     
         26        SEND_VAR                                                 $19
         27        DO_ICALL                                         $20     
         28        ASSIGN_DIM                                               !7, !6
         29        OP_DATA                                                  $20
   11    30      > JMP                                                      ->20
         31    >   FE_FREE                                                  $17
   15    32        INIT_FCALL                                               'var_dump'
         33        SEND_VAR                                                 !7
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.33 ms | 1003 KiB | 18 Q