3v4l.org

run code in 300+ PHP versions simultaneously
<?php function generator() { for ($i=1; $i<10; $i++) { echo "y:$i"; yield $i; }; } $a = iterator_to_array(generator()); print_r($a); foreach (generator() as $c) { echo $c; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/dl83V
function name:  (null)
number of ops:  17
compiled vars:  !0 = $a, !1 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'iterator_to_array'
          1        INIT_FCALL                                               'generator'
          2        DO_FCALL                                      0  $2      
          3        SEND_VAR                                                 $2
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !0, $3
   13     6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   15     9        INIT_FCALL                                               'generator'
         10        DO_FCALL                                      0  $6      
         11      > FE_RESET_R                                       $7      $6, ->15
         12    > > FE_FETCH_R                                               $7, !1, ->15
   16    13    >   ECHO                                                     !1
   15    14      > JMP                                                      ->12
         15    >   FE_FREE                                                  $7
   17    16      > RETURN                                                   1

Function generator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
Branch analysis from position: 3
filename:       /in/dl83V
function name:  generator
number of ops:  11
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    5     1        ASSIGN                                                   !0, 1
          2      > JMP                                                      ->8
    6     3    >   NOP                                                      
          4        FAST_CONCAT                                      ~2      'y%3A', !0
          5        ECHO                                                     ~2
    7     6        YIELD                                                    !0
    5     7        PRE_INC                                                  !0
          8    >   IS_SMALLER                                               !0, 10
          9      > JMPNZ                                                    ~5, ->3
    9    10    > > GENERATOR_RETURN                                         

End of function generator

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.66 ms | 1399 KiB | 19 Q