3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = simplexml_load_string(<<<EOD <x> <ml>1</ml> <ml>2</ml> <ml>3</ml> <ml>4</ml> <ml>5</ml> </x> EOD ); $gen = function() use ($xml) { $it = new IteratorIterator($xml->ml); $it->rewind(); $norewit = new NoRewindIterator($it); $count = 0; foreach ($norewit as $key => $value) { $count++; yield $key => "[$value]"; if ($count < 2) { continue; } $norewit->next(); yield from $norewit; } }; print_r(iterator_to_array($gen(), false));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HQmQj
function name:  (null)
number of ops:  17
compiled vars:  !0 = $xml, !1 = $gen
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'simplexml_load_string'
    4     1        SEND_VAL                                                 '%3Cx%3E%0A++++%3Cml%3E1%3C%2Fml%3E%0A++++%3Cml%3E2%3C%2Fml%3E%0A++++%3Cml%3E3%3C%2Fml%3E%0A++++%3Cml%3E4%3C%2Fml%3E%0A++++%3Cml%3E5%3C%2Fml%3E%0A%3C%2Fx%3E'
          2        DO_ICALL                                         $2      
    3     3        ASSIGN                                                   !0, $2
   14     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FHQmQj%3A14%240'
          5        BIND_LEXICAL                                             ~4, !0
          6        ASSIGN                                                   !1, ~4
   31     7        INIT_FCALL                                               'print_r'
          8        INIT_FCALL                                               'iterator_to_array'
          9        INIT_DYNAMIC_CALL                                        !1
         10        DO_FCALL                                      0  $6      
         11        SEND_VAR                                                 $6
         12        SEND_VAL                                                 <false>
         13        DO_ICALL                                         $7      
         14        SEND_VAR                                                 $7
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FHQmQj%3A14%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 31
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 31
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 26
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 31
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 31
filename:       /in/HQmQj
function name:  {closure}
number of ops:  33
compiled vars:  !0 = $xml, !1 = $it, !2 = $norewit, !3 = $count, !4 = $value, !5 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   GENERATOR_CREATE                                         
          1        BIND_STATIC                                              !0
   15     2        NEW                                              $6      'IteratorIterator'
          3        CHECK_FUNC_ARG                                           
          4        FETCH_OBJ_FUNC_ARG                               $7      !0, 'ml'
          5        SEND_FUNC_ARG                                            $7
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $6
   16     8        INIT_METHOD_CALL                                         !1, 'rewind'
          9        DO_FCALL                                      0          
   17    10        NEW                                              $11     'NoRewindIterator'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !2, $11
   18    14        ASSIGN                                                   !3, 0
   19    15      > FE_RESET_R                                       $15     !2, ->31
         16    > > FE_FETCH_R                                       ~16     $15, !4, ->31
         17    >   ASSIGN                                                   !5, ~16
   21    18        PRE_INC                                                  !3
   22    19        ROPE_INIT                                     3  ~20     '%5B'
         20        ROPE_ADD                                      1  ~20     ~20, !4
         21        ROPE_END                                      2  ~19     ~20, '%5D'
         22        YIELD                                                    ~19, !5
   23    23        IS_SMALLER                                               !3, 2
         24      > JMPZ                                                     ~23, ->26
   24    25    > > JMP                                                      ->16
   26    26    >   INIT_METHOD_CALL                                         !2, 'next'
         27        DO_FCALL                                      0          
   27    28        YIELD_FROM                                       ~25     !2
         29        FREE                                                     ~25
   19    30      > JMP                                                      ->16
         31    >   FE_FREE                                                  $15
   29    32      > GENERATOR_RETURN                                         

End of function %00%7Bclosure%7D%2Fin%2FHQmQj%3A14%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.01 ms | 945 KiB | 20 Q