3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function gen1() { yield 1; yield 2; yield 3; } function gen2(bool $opt) { if ($opt) return gen1(); yield 4; yield 5; yield 6; } gen2(true); gen2(false);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/D8QQd
function name:  (null)
number of ops:  9
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   3     0  E >   NOP                                                      
  10     1        NOP                                                      
  20     2        INIT_FCALL                                               'gen2'
         3        SEND_VAL                                                 <true>
         4        DO_FCALL                                      0          
  21     5        INIT_FCALL                                               'gen2'
         6        SEND_VAL                                                 <false>
         7        DO_FCALL                                      0          
         8      > RETURN                                                   1

Function gen1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/D8QQd
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/D8QQd
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 7.3.0