3v4l.org

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

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

End of function bar

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.72 ms | 1000 KiB | 16 Q