3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myArray = array( 0 => 'a', 1 => array('subA','subB',array(0 => 'subsubA', 1 => 'subsubB', 2 => array(0 => 'deepA', 1 => 'deepB'))), 2 => 'b', 3 => array('subA','subB','subC'), 4 => 'c' ); $iterator = new RecursiveArrayIterator($myArray); iterator_apply($iterator, 'traverseStructure', array($iterator)); function traverseStructure($iterator) { while ( $iterator -> valid() ) { if ( $iterator -> hasChildren() ) { traverseStructure($iterator -> getChildren()); } else { echo $iterator -> key() . ' : ' . $iterator -> current() .PHP_EOL; } $iterator -> next(); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dB8AP
function name:  (null)
number of ops:  12
compiled vars:  !0 = $myArray, !1 = $iterator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   10     1        NEW                                              $3      'RecursiveArrayIterator'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $3
   11     5        INIT_FCALL                                               'iterator_apply'
          6        SEND_VAR                                                 !1
          7        SEND_VAL                                                 'traverseStructure'
          8        INIT_ARRAY                                       ~6      !1
          9        SEND_VAL                                                 ~6
         10        DO_ICALL                                                 
   28    11      > RETURN                                                   1

Function traversestructure:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 11
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 2
Branch analysis from position: 24
Branch analysis from position: 2
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 2
Branch analysis from position: 24
Branch analysis from position: 2
filename:       /in/dB8AP
function name:  traverseStructure
number of ops:  25
compiled vars:  !0 = $iterator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   15     1      > JMP                                                      ->21
   17     2    >   INIT_METHOD_CALL                                         !0, 'hasChildren'
          3        DO_FCALL                                      0  $1      
          4      > JMPZ                                                     $1, ->11
   19     5    >   INIT_FCALL_BY_NAME                                       'traverseStructure'
          6        INIT_METHOD_CALL                                         !0, 'getChildren'
          7        DO_FCALL                                      0  $2      
          8        SEND_VAR_NO_REF_EX                                       $2
          9        DO_FCALL                                      0          
         10      > JMP                                                      ->19
   23    11    >   INIT_METHOD_CALL                                         !0, 'key'
         12        DO_FCALL                                      0  $4      
         13        CONCAT                                           ~5      $4, '+%3A+'
         14        INIT_METHOD_CALL                                         !0, 'current'
         15        DO_FCALL                                      0  $6      
         16        CONCAT                                           ~7      ~5, $6
         17        CONCAT                                           ~8      ~7, '%0A'
         18        ECHO                                                     ~8
   26    19    >   INIT_METHOD_CALL                                         !0, 'next'
         20        DO_FCALL                                      0          
   15    21    >   INIT_METHOD_CALL                                         !0, 'valid'
         22        DO_FCALL                                      0  $10     
         23      > JMPNZ                                                    $10, ->2
   28    24    > > RETURN                                                   null

End of function traversestructure

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
195.88 ms | 1400 KiB | 15 Q