3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array(); $a = [0,1,2,3,4,5]; $b = [0,1,2,3,4,5]; $c = [0,1,2,3,4,5]; $d = [0,1,2,3,4,5]; $e = [0,1,2,3,4,5]; $f = [0,1,2,3,4,5]; $g = [0,1,2,3,4,5]; $arr[] = $a; $arr[] = $b; $arr[] = $c; $arr[0][2] = $d; $arr[0][2][3] = $e; $arr[2][1] = $f; $arr[1] = $g; print_r($arr); function array_keys_recur($array) { if(!is_array($array)) return false; $keys = array_keys($array); foreach($keys as $k => $key) { $keys[$k] = array_keys_recur($key); } return $keys; } $keys = array_keys_recur($arr); print_r($keys);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DOpad
function name:  (null)
number of ops:  37
compiled vars:  !0 = $arr, !1 = $a, !2 = $b, !3 = $c, !4 = $d, !5 = $e, !6 = $f, !7 = $g, !8 = $keys
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>
    7     4        ASSIGN                                                   !4, <array>
    8     5        ASSIGN                                                   !5, <array>
    9     6        ASSIGN                                                   !6, <array>
   10     7        ASSIGN                                                   !7, <array>
   11     8        ASSIGN_DIM                                               !0
          9        OP_DATA                                                  !1
   12    10        ASSIGN_DIM                                               !0
         11        OP_DATA                                                  !2
   13    12        ASSIGN_DIM                                               !0
         13        OP_DATA                                                  !3
   14    14        FETCH_DIM_W                                      $20     !0, 0
         15        ASSIGN_DIM                                               $20, 2
         16        OP_DATA                                                  !4
   15    17        FETCH_DIM_W                                      $22     !0, 0
         18        FETCH_DIM_W                                      $23     $22, 2
         19        ASSIGN_DIM                                               $23, 3
         20        OP_DATA                                                  !5
   16    21        FETCH_DIM_W                                      $25     !0, 2
         22        ASSIGN_DIM                                               $25, 1
         23        OP_DATA                                                  !6
   17    24        ASSIGN_DIM                                               !0, 1
         25        OP_DATA                                                  !7
   19    26        INIT_FCALL                                               'print_r'
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                                 
   30    29        INIT_FCALL                                               'array_keys_recur'
         30        SEND_VAR                                                 !0
         31        DO_FCALL                                      0  $29     
         32        ASSIGN                                                   !8, $29
   32    33        INIT_FCALL                                               'print_r'
         34        SEND_VAR                                                 !8
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

Function array_keys_recur:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/DOpad
function name:  array_keys_recur
number of ops:  21
compiled vars:  !0 = $array, !1 = $keys, !2 = $key, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1        TYPE_CHECK                                  128  ~4      !0
          2        BOOL_NOT                                         ~5      ~4
          3      > JMPZ                                                     ~5, ->5
          4    > > RETURN                                                   <false>
   23     5    >   INIT_FCALL                                               'array_keys'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !1, $6
   24     9      > FE_RESET_R                                       $8      !1, ->18
         10    > > FE_FETCH_R                                       ~9      $8, !2, ->18
         11    >   ASSIGN                                                   !3, ~9
   25    12        INIT_FCALL_BY_NAME                                       'array_keys_recur'
         13        SEND_VAR_EX                                              !2
         14        DO_FCALL                                      0  $12     
         15        ASSIGN_DIM                                               !1, !3
         16        OP_DATA                                                  $12
   24    17      > JMP                                                      ->10
         18    >   FE_FREE                                                  $8
   27    19      > RETURN                                                   !1
   28    20*     > RETURN                                                   null

End of function array_keys_recur

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.57 ms | 1403 KiB | 18 Q