3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen1() { $x = yield 1; yield 2; yield $x; } function gen2() { yield from gen1(); yield from gen1(); } function gen3() { yield from gen2(); } $g = gen3(); var_dump($g->current()); $g->send(100); while($g->valid()) { $val = $g->next(); var_dump($val); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 12
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 12
Branch analysis from position: 21
Branch analysis from position: 12
filename:       /in/KJCcZ
function name:  (null)
number of ops:  22
compiled vars:  !0 = $g, !1 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'gen3'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   19     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'current'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
   20     8        INIT_METHOD_CALL                                         !0, 'send'
          9        SEND_VAL_EX                                              100
         10        DO_FCALL                                      0          
   21    11      > JMP                                                      ->18
   22    12    >   INIT_METHOD_CALL                                         !0, 'next'
         13        DO_FCALL                                      0  $7      
         14        ASSIGN                                                   !1, $7
   23    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
   21    18    >   INIT_METHOD_CALL                                         !0, 'valid'
         19        DO_FCALL                                      0  $10     
         20      > JMPNZ                                                    $10, ->12
   24    21    > > RETURN                                                   1

Function gen1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/KJCcZ
function name:  gen1
number of ops:  6
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    4     1        YIELD                                            $1      1
          2        ASSIGN                                                   !0, $1
    5     3        YIELD                                                    2
    6     4        YIELD                                                    !0
    7     5      > GENERATOR_RETURN                                         

End of function gen1

Function gen2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/KJCcZ
function name:  gen2
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   GENERATOR_CREATE                                         
   10     1        INIT_FCALL                                               'gen1'
          2        DO_FCALL                                      0  $0      
          3        YIELD_FROM                                       ~1      $0
          4        FREE                                                     ~1
   11     5        INIT_FCALL                                               'gen1'
          6        DO_FCALL                                      0  $2      
          7        YIELD_FROM                                       ~3      $2
          8        FREE                                                     ~3
   12     9      > GENERATOR_RETURN                                         

End of function gen2

Function gen3:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/KJCcZ
function name:  gen3
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   GENERATOR_CREATE                                         
   15     1        INIT_FCALL                                               'gen2'
          2        DO_FCALL                                      0  $0      
          3        YIELD_FROM                                       ~1      $0
          4        FREE                                                     ~1
   16     5      > GENERATOR_RETURN                                         

End of function gen3

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.53 ms | 1394 KiB | 19 Q