3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/35o06
function name:  (null)
number of ops:  14
compiled vars:  !0 = $array, !1 = $result, !2 = $prevKey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     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%2F35o06%3A26%240'
          6        BIND_LEXICAL                                             ~6, !1
          7        BIND_LEXICAL                                             ~6, !2
   33     8        SEND_VAL                                                 ~6
          9        DO_ICALL                                                 
   35    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F35o06%3A26%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
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: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/35o06
function name:  {closure}
number of ops:  11
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        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
   27     4        TYPE_CHECK                                  128  ~4      !0
          5        BOOL_NOT                                         ~5      ~4
          6      > JMPZ                                                     ~5, ->8
          7    > > JMP                                                      ->10
   30     8    >   ASSIGN                                                   !3, !1
   31     9        ECHO                                                     !3
   33    10    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F35o06%3A26%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.67 ms | 1396 KiB | 17 Q