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
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FvV5o
function name:  (null)
number of ops:  7
compiled vars:  !0 = $generator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'foo'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   10     3        INIT_METHOD_CALL                                         !0, 'send'
          4        SEND_VAL_EX                                              'Hello+world%21'
          5        DO_FCALL                                      0          
   11     6      > RETURN                                                   1

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

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.78 ms | 1388 KiB | 14 Q