3v4l.org

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

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

End of function printer

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.41 ms | 1399 KiB | 14 Q