3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** @return Generator */ function example() { for ($i = 0; $i < 5; $i += 1) { $answer = (yield $i * 2); echo "received: $answer\n"; } } $gen = example(); foreach ($gen as $x) { echo "sending $x\n"; $gen->send($x); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/bfg64
function name:  (null)
number of ops:  15
compiled vars:  !0 = $gen, !1 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'example'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   12     3      > FE_RESET_R                                       $4      !0, ->13
          4    > > FE_FETCH_R                                               $4, !1, ->13
   13     5    >   ROPE_INIT                                     3  ~6      'sending+'
          6        ROPE_ADD                                      1  ~6      ~6, !1
          7        ROPE_END                                      2  ~5      ~6, '%0A'
          8        ECHO                                                     ~5
   14     9        INIT_METHOD_CALL                                         !0, 'send'
         10        SEND_VAR_EX                                              !1
         11        DO_FCALL                                      0          
   12    12      > JMP                                                      ->4
         13    >   FE_FREE                                                  $4
   15    14      > RETURN                                                   1

Function example:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 3
Branch analysis from position: 13
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 3
Branch analysis from position: 13
Branch analysis from position: 3
filename:       /in/bfg64
function name:  example
number of ops:  14
compiled vars:  !0 = $i, !1 = $answer
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   GENERATOR_CREATE                                         
    5     1        ASSIGN                                                   !0, 0
          2      > JMP                                                      ->11
    6     3    >   MUL                                              ~3      !0, 2
          4        YIELD                                            $4      ~3
          5        ASSIGN                                                   !1, $4
    7     6        ROPE_INIT                                     3  ~7      'received%3A+'
          7        ROPE_ADD                                      1  ~7      ~7, !1
          8        ROPE_END                                      2  ~6      ~7, '%0A'
          9        ECHO                                                     ~6
    5    10        ASSIGN_OP                                     1          !0, 1
         11    >   IS_SMALLER                                               !0, 5
         12      > JMPNZ                                                    ~10, ->3
    9    13    > > GENERATOR_RETURN                                         

End of function example

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
193.74 ms | 1399 KiB | 14 Q