3v4l.org

run code in 500+ PHP versions simultaneously
<?php function foo() { yield 1; return "a"; } function goo($a) { print $a . PHP_EOL; } goo(...($generator = foo())); print $generator->getReturn(); // la foreach (($generator = foo()) as $b) { print $b . PHP_EOL; } print $generator->getReturn(); // la ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 18
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/S24Re
function name:  (null)
number of ops:  23
compiled vars:  !0 = $generator, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                                   'goo'
          1        INIT_FCALL                                                   'foo'
          2        DO_FCALL                                          0  $2      
          3        ASSIGN                                               ~3      !0, $2
          4        SEND_UNPACK                                                  ~3
          5        CHECK_UNDEF_ARGS                                             
          6        DO_FCALL                                          0          
   14     7        INIT_METHOD_CALL                                             !0, 'getReturn'
          8        DO_FCALL                                          0  $5      
          9        ECHO                                                         $5
   17    10        INIT_FCALL                                                   'foo'
         11        DO_FCALL                                          0  $6      
         12        ASSIGN                                               ~7      !0, $6
         13      > FE_RESET_R                                           $8      ~7, ->18
         14    > > FE_FETCH_R                                                   $8, !1, ->18
   18    15    >   CONCAT                                               ~9      !1, '%0A'
         16        ECHO                                                         ~9
   17    17      > JMP                                                          ->14
         18    >   FE_FREE                                                      $8
   20    19        INIT_METHOD_CALL                                             !0, 'getReturn'
         20        DO_FCALL                                          0  $10     
         21        ECHO                                                         $10
   23    22      > RETURN                                                       1

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

End of function foo

Function goo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/S24Re
function name:  goo
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
    9     1        CONCAT                                               ~1      !0, '%0A'
          2        ECHO                                                         ~1
   10     3      > RETURN                                                       null

End of function goo

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
170.87 ms | 1476 KiB | 16 Q