3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen() { for($i = 1; $i <=3; $i++) { $resp = (yield $i); echo '$resp: '; var_dump($i); } $gen = gen(); foreach($gen as $out) { echo '$i: '; var_dump($i); $gen->send('Hi ' . $i); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r12gc
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E > > RETURN                                                   1

Function gen:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 3
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 26
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 26
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 26
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 26
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 3
Branch analysis from position: 12
Branch analysis from position: 3
filename:       /in/r12gc
function name:  gen
number of ops:  28
compiled vars:  !0 = $i, !1 = $resp, !2 = $gen, !3 = $out
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    5     1        ASSIGN                                                   !0, 1
          2      > JMP                                                      ->10
    7     3    >   YIELD                                            $5      !0
          4        ASSIGN                                                   !1, $5
    8     5        ECHO                                                     '%24resp%3A+'
    9     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
    5     9        PRE_INC                                                  !0
         10    >   IS_SMALLER_OR_EQUAL                                      !0, 3
         11      > JMPNZ                                                    ~9, ->3
   12    12    >   INIT_FCALL_BY_NAME                                       'gen'
         13        DO_FCALL                                      0  $10     
         14        ASSIGN                                                   !2, $10
   13    15      > FE_RESET_R                                       $12     !2, ->26
         16    > > FE_FETCH_R                                               $12, !3, ->26
   15    17    >   ECHO                                                     '%24i%3A+'
   16    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                                 
   17    21        INIT_METHOD_CALL                                         !2, 'send'
         22        CONCAT                                           ~14     'Hi+', !0
         23        SEND_VAL_EX                                              ~14
         24        DO_FCALL                                      0          
   13    25      > JMP                                                      ->16
         26    >   FE_FREE                                                  $12
   19    27      > GENERATOR_RETURN                                         

End of function gen

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.31 ms | 1396 KiB | 15 Q