3v4l.org

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

Function printer:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/kHv9h
function name:  printer
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      > GENERATOR_RETURN                                         
    5     4*     > GENERATOR_RETURN                                         

End of function printer

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.12 ms | 1389 KiB | 14 Q