3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_keys_recursive(array $array) : array { foreach ($array as $key => $value) { if (is_array($value)) { $index[$key] = array_keys_recursive($value); } else { $index []= $key; } } return $index ?? []; } $a = ['a'=>11, 'b'=>2,'c'=>['r'=>5,'s'=>8]]; $b = ['a'=>1, 'b'=>2, 'c'=>['r'=>15,'s'=>18]]; var_dump(array_keys_recursive($a) === array_keys_recursive($b)); $a = ['a'=>11, 'b'=>2,'c'=>['r'=>5,'s'=>8]]; $b = ['a'=>1, 'c'=>2, 'b'=>['r'=>15,'s'=>18]]; var_dump(array_keys_recursive($a) === array_keys_recursive($b)); $a = ['a'=>11, 'b'=>2,'c'=>['r'=>5,'s'=>8]]; $b = ['a'=>1, 'b'=>2, 'c'=>['r1'=>15,'m'=>18]]; var_dump(array_keys_recursive($a) === array_keys_recursive($b));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jDmON
function name:  (null)
number of ops:  37
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   ASSIGN                                                   !0, <array>
   18     1        ASSIGN                                                   !1, <array>
   20     2        INIT_FCALL                                               'var_dump'
          3        INIT_FCALL                                               'array_keys_recursive'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $4      
          6        INIT_FCALL                                               'array_keys_recursive'
          7        SEND_VAR                                                 !1
          8        DO_FCALL                                      0  $5      
          9        IS_IDENTICAL                                     ~6      $4, $5
         10        SEND_VAL                                                 ~6
         11        DO_ICALL                                                 
   22    12        ASSIGN                                                   !0, <array>
   23    13        ASSIGN                                                   !1, <array>
   25    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'array_keys_recursive'
         16        SEND_VAR                                                 !0
         17        DO_FCALL                                      0  $10     
         18        INIT_FCALL                                               'array_keys_recursive'
         19        SEND_VAR                                                 !1
         20        DO_FCALL                                      0  $11     
         21        IS_IDENTICAL                                     ~12     $10, $11
         22        SEND_VAL                                                 ~12
         23        DO_ICALL                                                 
   27    24        ASSIGN                                                   !0, <array>
   28    25        ASSIGN                                                   !1, <array>
   30    26        INIT_FCALL                                               'var_dump'
         27        INIT_FCALL                                               'array_keys_recursive'
         28        SEND_VAR                                                 !0
         29        DO_FCALL                                      0  $16     
         30        INIT_FCALL                                               'array_keys_recursive'
         31        SEND_VAR                                                 !1
         32        DO_FCALL                                      0  $17     
         33        IS_IDENTICAL                                     ~18     $16, $17
         34        SEND_VAL                                                 ~18
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

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

End of function array_keys_recursive

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.93 ms | 1012 KiB | 20 Q