3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 'USA' => [ 'Alabama' => [ 'Montgomery', 'Birmingham' ], 'Arizona' => [ 'Phoenix', 'Mesa', 'Gilbert' ] ], 'Germany' => [ 'West Germany' => [ 'Bonn', 'Cologne' ] ] ]; $iterator = new RecursiveIteratorIterator(new RecursiveArrayIterator($arr)); $keys = array(); foreach ($iterator as $key => $value) { // Build long key name based on parent keys for ($i = $iterator->getDepth() - 1; $i >= 0; $i--) { $key = $iterator->getSubIterator($i)->key() . '_' . $key; } $keys[] = $key; } var_export($keys);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 31
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 31
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 17
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 17
Branch analysis from position: 28
Branch analysis from position: 17
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/gtChH
function name:  (null)
number of ops:  36
compiled vars:  !0 = $arr, !1 = $iterator, !2 = $keys, !3 = $value, !4 = $key, !5 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   26     1        NEW                                              $7      'RecursiveIteratorIterator'
          2        NEW                                              $8      'RecursiveArrayIterator'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        SEND_VAR_NO_REF_EX                                       $8
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $7
   27     8        ASSIGN                                                   !2, <array>
   28     9      > FE_RESET_R                                       $13     !1, ->31
         10    > > FE_FETCH_R                                       ~14     $13, !3, ->31
         11    >   ASSIGN                                                   !4, ~14
   30    12        INIT_METHOD_CALL                                         !1, 'getDepth'
         13        DO_FCALL                                      0  $16     
         14        SUB                                              ~17     $16, 1
         15        ASSIGN                                                   !5, ~17
         16      > JMP                                                      ->26
   31    17    >   INIT_METHOD_CALL                                         !1, 'getSubIterator'
         18        SEND_VAR_EX                                              !5
         19        DO_FCALL                                      0  $19     
         20        INIT_METHOD_CALL                                         $19, 'key'
         21        DO_FCALL                                      0  $20     
         22        CONCAT                                           ~21     $20, '_'
         23        CONCAT                                           ~22     ~21, !4
         24        ASSIGN                                                   !4, ~22
   30    25        PRE_DEC                                                  !5
         26    >   IS_SMALLER_OR_EQUAL                                      0, !5
         27      > JMPNZ                                                    ~25, ->17
   33    28    >   ASSIGN_DIM                                               !2
         29        OP_DATA                                                  !4
   28    30      > JMP                                                      ->10
         31    >   FE_FREE                                                  $13
   35    32        INIT_FCALL                                               'var_export'
         33        SEND_VAR                                                 !2
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.09 ms | 1400 KiB | 15 Q