3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen1() { $a = yield 5; return ($a + yield 2) - ($a + yield 1) * yield 3; } $g = gen1(); $g->next(); var_dump($g->current());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gaSsZ
function name:  (null)
number of ops:  11
compiled vars:  !0 = $g
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'gen1'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
    9     3        INIT_METHOD_CALL                                         !0, 'next'
          4        DO_FCALL                                      0          
   10     5        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !0, 'current'
          7        DO_FCALL                                      0  $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

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

End of function gen1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
199.23 ms | 1398 KiB | 16 Q