3v4l.org

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

End of function printer

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.87 ms | 1399 KiB | 16 Q