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") { echo $value . PHP_EOL; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 16
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/4IYYh
function name:  (null)
number of ops:  19
compiled vars:  !0 = $array, !1 = $selectedValues, !2 = $iterator, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   12     1        ASSIGN                                                   !1, <array>
   13     2        NEW                                              $7      'RecursiveIteratorIterator'
          3        NEW                                              $8      'RecursiveArrayIterator'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        SEND_VAR_NO_REF_EX                                       $8
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $7
   14     9      > FE_RESET_R                                       $12     !2, ->17
         10    > > FE_FETCH_R                                       ~13     $12, !3, ->17
         11    >   ASSIGN                                                   !4, ~13
   15    12        IS_EQUAL                                                 !4, 'selected'
         13      > JMPZ                                                     ~15, ->16
   16    14    >   CONCAT                                           ~16     !3, '%0A'
         15        ECHO                                                     ~16
   14    16    > > JMP                                                      ->10
         17    >   FE_FREE                                                  $12
   18    18      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.72 ms | 1393 KiB | 13 Q