3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = [ 1 => [ 1 => [ 'anna', 'alice' ], 2 => [ 'bob', 'bartold' ] ], 2 => [ 1 => [ 'carol' ], 2 => [ 'david' ] ] ]; $result = []; $prevKey = 0; array_walk_recursive($array, function ($value, $key) use (&$result, &$prevKey) { if (!is_array($value)) { }else { $prevKey = $key; echo $prevKey; } }); var_dump($result);
based on 2WEpY
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/35o06
function name:  (null)
number of ops:  12
compiled vars:  !0 = $array, !1 = $result, !2 = $prevKey
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  13     0  E >   ASSIGN                                                   !0, <array>
  24     1        ASSIGN                                                   !1, <array>
  25     2        ASSIGN                                                   !2, 0
  26     3        INIT_FCALL                                               'array_walk_recursive'
         4        SEND_REF                                                 !0
         5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F35o060x7f2467a6b1ec'
  33     6        SEND_VAL                                                 ~6
         7        DO_ICALL                                                 
  35     8        INIT_FCALL                                               'var_dump'
         9        SEND_VAR                                                 !1
        10        DO_ICALL                                                 
        11      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F35o060x7f2467a6b1ec:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
Jump found. Position 1 = 12
Branch analysis from position: 12
Jump found. Position 1 = -2
Branch analysis from position: 10
Jump found. Position 1 = -2
filename:       /in/35o06
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $value, !1 = $key, !2 = $result, !3 = $prevKey
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  26     0  E >   RECV                                             !0      
         1        RECV                                             !1      
         2        FETCH_W                      static              $4      'result'
         3        ASSIGN_REF                                               !2, $4
         4        FETCH_W                      static              $5      'prevKey'
         5        ASSIGN_REF                                               !3, $5
  27     6        TYPE_CHECK                                    7  ~6      !0
         7        BOOL_NOT                                         ~7      ~6
         8      > JMPZ                                                     ~7, ->10
         9    > > JMP                                                      ->12
  30    10    >   ASSIGN                                                   !3, !1
  31    11        ECHO                                                     !3
  33    12    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F35o060x7f2467a6b1ec

Generated using Vulcan Logic Dumper, using php 7.3.0