3v4l.org

run code in 500+ PHP versions simultaneously
<?php function printer() { $line = 1; while (true) { $string = yield; echo ($line++).$string.PHP_EOL; } } $printer = printer(); $printer->send('Hello world!'); $printer->send('Bye world!');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/L0Pra
function name:  (null)
number of ops:  10
compiled vars:  !0 = $printer
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                                   'printer'
          1        DO_FCALL                                          0  $1      
          2        ASSIGN                                                       !0, $1
   13     3        INIT_METHOD_CALL                                             !0, 'send'
          4        SEND_VAL_EX                                                  'Hello+world%21'
          5        DO_FCALL                                          0          
   14     6        INIT_METHOD_CALL                                             !0, 'send'
          7        SEND_VAL_EX                                                  'Bye+world%21'
          8        DO_FCALL                                          0          
          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 = 3
Branch analysis from position: 10
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 3
Branch analysis from position: 10
Branch analysis from position: 3
filename:       /in/L0Pra
function name:  printer
number of ops:  11
compiled vars:  !0 = $line, !1 = $string
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                             
    4     1        ASSIGN                                                       !0, 1
    6     2      > JMP                                                          ->9
    7     3    >   YIELD                                                $3      
          4        ASSIGN                                                       !1, $3
    8     5        POST_INC                                             ~5      !0
          6        CONCAT                                               ~6      ~5, !1
          7        CONCAT                                               ~7      ~6, '%0A'
          8        ECHO                                                         ~7
    6     9    > > JMPNZ                                                        <true>, ->3
   10    10    > > GENERATOR_RETURN                                             

End of function printer

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.14 ms | 2578 KiB | 14 Q