3v4l.org

run code in 300+ PHP versions simultaneously
<?php function printer() { $i=true; $times=1; while ($i) { $string = yield; yield $string; $times++; $i=false; } var_dump($i,$times); } $printer = printer(); $printer->send('Hello world!'); echo $printer->current(); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AeWPH
function name:  (null)
number of ops:  10
compiled vars:  !0 = $printer
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'printer'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
   15     3        INIT_METHOD_CALL                                         !0, 'send'
          4        SEND_VAL_EX                                              'Hello+world%21'
          5        DO_FCALL                                      0          
   16     6        INIT_METHOD_CALL                                         !0, 'current'
          7        DO_FCALL                                      0  $4      
          8        ECHO                                                     $4
   17     9      > RETURN                                                   1

Function printer:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 4
Branch analysis from position: 10
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 4
Branch analysis from position: 10
Branch analysis from position: 4
filename:       /in/AeWPH
function name:  printer
number of ops:  15
compiled vars:  !0 = $i, !1 = $times, !2 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   GENERATOR_CREATE                                         
    3     1        ASSIGN                                                   !0, <true>
    4     2        ASSIGN                                                   !1, 1
    5     3      > JMP                                                      ->9
    6     4    >   YIELD                                            $5      
          5        ASSIGN                                                   !2, $5
    7     6        YIELD                                                    !2
    8     7        PRE_INC                                                  !1
    9     8        ASSIGN                                                   !0, <false>
    5     9    > > JMPNZ                                                    !0, ->4
   11    10    >   INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !0
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                                 
   12    14      > GENERATOR_RETURN                                         

End of function printer

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.53 ms | 1399 KiB | 16 Q