3v4l.org

run code in 300+ PHP versions simultaneously
<?php function bar($x){ if($x){ yield 1; yield 2; }else{ return 'a'; } } var_dump(bar(true)); var_dump(bar(false));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/M2aeM
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'bar'
          2        SEND_VAL                                                 <true>
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   13     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'bar'
          8        SEND_VAL                                                 <false>
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function bar:
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 = 42) Position 1 = 7
Branch analysis from position: 7
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/M2aeM
function name:  bar
number of ops:  8
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
    4     2      > JMPZ                                                     !0, ->6
    5     3    >   YIELD                                                    1
    6     4        YIELD                                                    2
    4     5      > JMP                                                      ->7
    8     6    > > GENERATOR_RETURN                                         
   10     7    > > GENERATOR_RETURN                                         

End of function bar

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
892.51 ms | 1000 KiB | 16 Q