3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = ['a' => ['b' => ['c' => 1]]]; $it = new RecursiveIteratorIterator(new RecursiveArrayIterator($data)); $flat = $keys = []; foreach ($it as $node) { foreach (range(0, $it->getDepth()) as $depth) { $keys[] = $it->getSubIterator($depth)->key(); } $flat[ join('.', $keys) ] = $node; $keys = []; } var_dump($flat);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 37
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 37
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 19, Position 2 = 28
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 28
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 28
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
filename:       /in/7eLAt
function name:  (null)
number of ops:  42
compiled vars:  !0 = $data, !1 = $it, !2 = $flat, !3 = $keys, !4 = $node, !5 = $depth
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     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
    5     8        ASSIGN                                           ~12     !3, <array>
          9        ASSIGN                                                   !2, ~12
    6    10      > FE_RESET_R                                       $14     !1, ->37
         11    > > FE_FETCH_R                                               $14, !4, ->37
    7    12    >   INIT_FCALL                                               'range'
         13        SEND_VAL                                                 0
         14        INIT_METHOD_CALL                                         !1, 'getDepth'
         15        DO_FCALL                                      0  $15     
         16        SEND_VAR                                                 $15
         17        DO_ICALL                                         $16     
         18      > FE_RESET_R                                       $17     $16, ->28
         19    > > FE_FETCH_R                                               $17, !5, ->28
    8    20    >   INIT_METHOD_CALL                                         !1, 'getSubIterator'
         21        SEND_VAR_EX                                              !5
         22        DO_FCALL                                      0  $19     
         23        INIT_METHOD_CALL                                         $19, 'key'
         24        DO_FCALL                                      0  $20     
         25        ASSIGN_DIM                                               !3
         26        OP_DATA                                                  $20
    7    27      > JMP                                                      ->19
         28    >   FE_FREE                                                  $17
   10    29        INIT_FCALL                                               'join'
         30        SEND_VAL                                                 '.'
         31        SEND_VAR                                                 !3
         32        DO_ICALL                                         $21     
         33        ASSIGN_DIM                                               !2, $21
         34        OP_DATA                                                  !4
   11    35        ASSIGN                                                   !3, <array>
    6    36      > JMP                                                      ->11
         37    >   FE_FREE                                                  $14
   14    38        INIT_FCALL                                               'var_dump'
         39        SEND_VAR                                                 !2
         40        DO_ICALL                                                 
         41      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.79 ms | 1400 KiB | 19 Q