3v4l.org

run code in 300+ PHP versions simultaneously
<?php $stats = array( array( "totalStatPower" => 4, ), array( "totalStatPower" => 5, "test" => 1, ), array( "totalStatPower" => 10, "test" => 2, ), ); var_dump(array_reduce($stats, function($a, $b) { return array_map(function($v, $k) use ($b) { return $v + isset($b[$k]) ? $b[$k] : 0; }, $a); }, array()));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/S5ZD0
function name:  (null)
number of ops:  11
compiled vars:  !0 = $stats
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   17     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'array_reduce'
          3        SEND_VAR                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FS5ZD0%3A17%240'
   22     5        SEND_VAL                                                 ~2
          6        SEND_VAL                                                 <array>
          7        DO_ICALL                                         $3      
          8        SEND_VAR                                                 $3
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FS5ZD0%3A17%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/S5ZD0
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   18     2        INIT_FCALL                                               'array_map'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FS5ZD0%3A18%241'
          4        BIND_LEXICAL                                             ~2, !1
   20     5        SEND_VAL                                                 ~2
   21     6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $3      
          8      > RETURN                                                   $3
   22     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FS5ZD0%3A17%240

Function %00%7Bclosure%7D%2Fin%2FS5ZD0%3A18%241:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/S5ZD0
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $v, !1 = $k, !2 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   19     3        ISSET_ISEMPTY_DIM_OBJ                         0  ~3      !2, !1
          4        ADD                                              ~4      !0, ~3
          5      > JMPZ                                                     ~4, ->9
          6    >   FETCH_DIM_R                                      ~5      !2, !1
          7        QM_ASSIGN                                        ~6      ~5
          8      > JMP                                                      ->10
          9    >   QM_ASSIGN                                        ~6      0
         10    > > RETURN                                                   ~6
   20    11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FS5ZD0%3A18%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.86 ms | 1400 KiB | 19 Q