3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A implements \IteratorAggregate { public function getIterator() { foreach (range(1, 3) as $item) { yield new \stdClass() => $item; } } } foreach (new A() as $k => $v) { var_dump($k, $v); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 11
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/ciF3A
function name:  (null)
number of ops:  13
compiled vars:  !0 = $v, !1 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'a'
   13     1        NEW                                              $2      'A'
          2        DO_FCALL                                      0          
          3      > FE_RESET_R                                       $4      $2, ->11
          4    > > FE_FETCH_R                                       ~5      $4, !0, ->11
          5    >   ASSIGN                                                   !1, ~5
   14     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !1
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
   13    10      > JMP                                                      ->4
         11    >   FE_FREE                                                  $4
   15    12      > RETURN                                                   1

Class A:
Function getiterator:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 11
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 11
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 11
filename:       /in/ciF3A
function name:  getIterator
number of ops:  13
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   GENERATOR_CREATE                                         
    7     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 3
          4        DO_ICALL                                         $1      
          5      > FE_RESET_R                                       $2      $1, ->11
          6    > > FE_FETCH_R                                               $2, !0, ->11
    8     7    >   NEW                                              $3      'stdClass'
          8        DO_FCALL                                      0          
          9        YIELD                                                    !0, $3
    7    10      > JMP                                                      ->6
         11    >   FE_FREE                                                  $2
   10    12      > GENERATOR_RETURN                                         

End of function getiterator

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
219.21 ms | 1396 KiB | 17 Q