3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myArray = array( 0, array( 0, 1, array( 0, 1, 2, array( 0, 1, 2, 3, array("the end") ) ) ) ); $recursive_array_iterator = new RecursiveArrayIterator($myArray); iterator_apply($recursive_array_iterator, 'traverseRecursiveArray', array($recursive_array_iterator)); function traverseRecursiveArray($iterator) { while ($iterator->valid()) { if ($iterator->hasChildren()) { traverseRecursiveArray($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/V8oXK
function name:  (null)
number of ops:  12
compiled vars:  !0 = $myArray, !1 = $recursive_array_iterator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   23     1        NEW                                              $3      'RecursiveArrayIterator'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $3
   24     5        INIT_FCALL                                               'iterator_apply'
          6        SEND_VAR                                                 !1
          7        SEND_VAL                                                 'traverseRecursiveArray'
          8        INIT_ARRAY                                       ~6      !1
          9        SEND_VAL                                                 ~6
         10        DO_ICALL                                                 
   37    11      > RETURN                                                   1

Function traverserecursivearray:
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/V8oXK
function name:  traverseRecursiveArray
number of ops:  25
compiled vars:  !0 = $iterator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
   28     1      > JMP                                                      ->21
   29     2    >   INIT_METHOD_CALL                                         !0, 'hasChildren'
          3        DO_FCALL                                      0  $1      
          4      > JMPZ                                                     $1, ->11
   30     5    >   INIT_FCALL_BY_NAME                                       'traverseRecursiveArray'
          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
   32    11    >   INIT_METHOD_CALL                                         !0, 'key'
         12        DO_FCALL                                      0  $4      
         13        CONCAT                                           ~5      $4, '+%3D%3E+'
         14        INIT_METHOD_CALL                                         !0, 'current'
         15        DO_FCALL                                      0  $6      
         16        CONCAT                                           ~7      ~5, $6
         17        CONCAT                                           ~8      ~7, '%0A'
         18        ECHO                                                     ~8
   35    19    >   INIT_METHOD_CALL                                         !0, 'next'
         20        DO_FCALL                                      0          
   28    21    >   INIT_METHOD_CALL                                         !0, 'valid'
         22        DO_FCALL                                      0  $10     
         23      > JMPNZ                                                    $10, ->2
   37    24    > > RETURN                                                   null

End of function traverserecursivearray

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.03 ms | 1400 KiB | 15 Q