3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen1() { yield 1; yield 2; yield 3; } function gen2(bool $opt) { if ($opt) return gen1(); yield 4; yield 5; yield 6; } print_r(iterator_to_array(gen2(true))); print_r(iterator_to_array(gen2(false)));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oXhYu
function name:  (null)
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'print_r'
          1        INIT_FCALL                                               'iterator_to_array'
          2        INIT_FCALL                                               'gen2'
          3        SEND_VAL                                                 <true>
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                         $1      
          7        SEND_VAR                                                 $1
          8        DO_ICALL                                                 
   21     9        INIT_FCALL                                               'print_r'
         10        INIT_FCALL                                               'iterator_to_array'
         11        INIT_FCALL                                               'gen2'
         12        SEND_VAL                                                 <false>
         13        DO_FCALL                                      0  $3      
         14        SEND_VAR                                                 $3
         15        DO_ICALL                                         $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function gen1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/oXhYu
function name:  gen1
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    5     1        YIELD                                                    1
    6     2        YIELD                                                    2
    7     3        YIELD                                                    3
    8     4      > GENERATOR_RETURN                                         

End of function gen1

Function gen2:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/oXhYu
function name:  gen2
number of ops:  10
compiled vars:  !0 = $opt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
   12     2      > JMPZ                                                     !0, ->6
   13     3    >   INIT_FCALL                                               'gen1'
          4        DO_FCALL                                      0  $1      
          5      > GENERATOR_RETURN                                         
   15     6    >   YIELD                                                    4
   16     7        YIELD                                                    5
   17     8        YIELD                                                    6
   18     9      > GENERATOR_RETURN                                         

End of function gen2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
193.19 ms | 1398 KiB | 20 Q