3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo() { $string = yield; echo $string; for ($i = 1; $i <= 3; $i++) { yield $i; } } $generator = foo(); $generator->send('Hello world!'); foreach ($generator as $value) echo "$value\n"; ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 12
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/cXo91
function name:  (null)
number of ops:  14
compiled vars:  !0 = $generator, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'foo'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   11     3        INIT_METHOD_CALL                                         !0, 'send'
          4        SEND_VAL_EX                                              'Hello+world%21'
          5        DO_FCALL                                      0          
   12     6      > FE_RESET_R                                       $5      !0, ->12
          7    > > FE_FETCH_R                                               $5, !1, ->12
          8    >   NOP                                                      
          9        FAST_CONCAT                                      ~6      !1, '%0A'
         10        ECHO                                                     ~6
         11      > JMP                                                      ->7
         12    >   FE_FREE                                                  $5
   13    13      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 6
Branch analysis from position: 10
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 6
Branch analysis from position: 10
Branch analysis from position: 6
filename:       /in/cXo91
function name:  foo
number of ops:  11
compiled vars:  !0 = $string, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   GENERATOR_CREATE                                         
    3     1        YIELD                                            $2      
          2        ASSIGN                                                   !0, $2
    4     3        ECHO                                                     !0
    5     4        ASSIGN                                                   !1, 1
          5      > JMP                                                      ->8
    6     6    >   YIELD                                                    !1
    5     7        PRE_INC                                                  !1
          8    >   IS_SMALLER_OR_EQUAL                                      !1, 3
          9      > JMPNZ                                                    ~7, ->6
    8    10    > > GENERATOR_RETURN                                         

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.36 ms | 1399 KiB | 14 Q