3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ping_pong() { for ($i = 1; $i <= 10; $i++) { echo 'a' . $i . PHP_EOL; $val = (yield $i); echo 'b' . $i . ':' . $val . PHP_EOL; //echo 'ping: ' . $val . PHP_EOL; } } $generator = ping_pong(); foreach ($generator as $value) { echo 'c' . $value . PHP_EOL; //echo 'pong: ' . $generator->send($value) . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/LTMY7
function name:  (null)
number of ops:  11
compiled vars:  !0 = $generator, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'ping_pong'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   15     3      > FE_RESET_R                                       $4      !0, ->9
          4    > > FE_FETCH_R                                               $4, !1, ->9
   17     5    >   CONCAT                                           ~5      'c', !1
          6        CONCAT                                           ~6      ~5, '%0A'
          7        ECHO                                                     ~6
   15     8      > JMP                                                      ->4
          9    >   FE_FREE                                                  $4
   19    10      > RETURN                                                   1

Function ping_pong:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 3
Branch analysis from position: 16
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 3
Branch analysis from position: 16
Branch analysis from position: 3
filename:       /in/LTMY7
function name:  ping_pong
number of ops:  17
compiled vars:  !0 = $i, !1 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   GENERATOR_CREATE                                         
    5     1        ASSIGN                                                   !0, 1
          2      > JMP                                                      ->14
    7     3    >   CONCAT                                           ~3      'a', !0
          4        CONCAT                                           ~4      ~3, '%0A'
          5        ECHO                                                     ~4
    8     6        YIELD                                            $5      !0
          7        ASSIGN                                                   !1, $5
    9     8        CONCAT                                           ~7      'b', !0
          9        CONCAT                                           ~8      ~7, '%3A'
         10        CONCAT                                           ~9      ~8, !1
         11        CONCAT                                           ~10     ~9, '%0A'
         12        ECHO                                                     ~10
    5    13        PRE_INC                                                  !0
         14    >   IS_SMALLER_OR_EQUAL                                      !0, 10
         15      > JMPNZ                                                    ~12, ->3
   12    16    > > GENERATOR_RETURN                                         

End of function ping_pong

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.53 ms | 1398 KiB | 14 Q