3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['a' => 1, 'b' => 2], ['a' => 2, 'b' => 2] ]; $data = new stdClass(['count'=>0,'a'=>0,'b'=>0]); var_dump($data); $cb = function($value, $key, &$data) { $data['count'] = $data['count'] + 1; $data['a'] = $data['a'] + $value['a']; $data['b'] = $data['b'] + $value['b']; }; array_walk($array, $cb, $data);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OHSDK
function name:  (null)
number of ops:  16
compiled vars:  !0 = $array, !1 = $data, !2 = $cb
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    8     1        NEW                                              $4      'stdClass'
          2        SEND_VAL_EX                                              <array>
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $4
   10     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
   12     8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FOHSDK%3A12%240'
          9        ASSIGN                                                   !2, ~8
   18    10        INIT_FCALL                                               'array_walk'
         11        SEND_REF                                                 !0
         12        SEND_VAR                                                 !2
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FOHSDK%3A12%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OHSDK
function name:  {closure}
number of ops:  18
compiled vars:  !0 = $value, !1 = $key, !2 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   13     3        FETCH_DIM_R                                      ~4      !2, 'count'
          4        ADD                                              ~5      ~4, 1
          5        ASSIGN_DIM                                               !2, 'count'
          6        OP_DATA                                                  ~5
   14     7        FETCH_DIM_R                                      ~7      !2, 'a'
          8        FETCH_DIM_R                                      ~8      !0, 'a'
          9        ADD                                              ~9      ~7, ~8
         10        ASSIGN_DIM                                               !2, 'a'
         11        OP_DATA                                                  ~9
   15    12        FETCH_DIM_R                                      ~11     !2, 'b'
         13        FETCH_DIM_R                                      ~12     !0, 'b'
         14        ADD                                              ~13     ~11, ~12
         15        ASSIGN_DIM                                               !2, 'b'
         16        OP_DATA                                                  ~13
   16    17      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FOHSDK%3A12%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.97 ms | 1396 KiB | 17 Q