3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( array("title" => 1, "children" => array( array( "selected" => true, "key" => 12345, "children" => array() ) ) ) ); $selectedValues = array(); $iterator = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($array)); foreach ($iterator as $key => $value) { if ($key == "selected") { $a = $iterator->getSubIterator(); var_dump($a); // echo $value . PHP_EOL; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 21
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 20
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 20
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/sfZMc
function name:  (null)
number of ops:  23
compiled vars:  !0 = $array, !1 = $selectedValues, !2 = $iterator, !3 = $value, !4 = $key, !5 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   12     1        ASSIGN                                                   !1, <array>
   13     2        NEW                                              $8      'RecursiveIteratorIterator'
          3        NEW                                              $9      'RecursiveArrayIterator'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        SEND_VAR_NO_REF_EX                                       $9
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $8
   14     9      > FE_RESET_R                                       $13     !2, ->21
         10    > > FE_FETCH_R                                       ~14     $13, !3, ->21
         11    >   ASSIGN                                                   !4, ~14
   15    12        IS_EQUAL                                                 !4, 'selected'
         13      > JMPZ                                                     ~16, ->20
   16    14    >   INIT_METHOD_CALL                                         !2, 'getSubIterator'
         15        DO_FCALL                                      0  $17     
         16        ASSIGN                                                   !5, $17
   17    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !5
         19        DO_ICALL                                                 
   14    20    > > JMP                                                      ->10
         21    >   FE_FREE                                                  $13
   20    22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.61 ms | 1395 KiB | 15 Q