3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gen() { var_dump(yield +1); var_dump(yield -1); var_dump(yield * -1); // other ops still should behave normally } for ($gen = gen(); $gen->valid(); $gen->send(1)) { echo "\n"; var_dump($gen->current()); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 4
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 4
Branch analysis from position: 16
Branch analysis from position: 4
filename:       /in/dTl8K
function name:  (null)
number of ops:  17
compiled vars:  !0 = $gen
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'gen'
          1        DO_FCALL                                      0  $1      
          2        ASSIGN                                                   !0, $1
          3      > JMP                                                      ->13
    8     4    >   ECHO                                                     '%0A'
    9     5        INIT_FCALL                                               'var_dump'
          6        INIT_METHOD_CALL                                         !0, 'current'
          7        DO_FCALL                                      0  $3      
          8        SEND_VAR                                                 $3
          9        DO_ICALL                                                 
    7    10        INIT_METHOD_CALL                                         !0, 'send'
         11        SEND_VAL_EX                                              1
         12        DO_FCALL                                      0          
         13    >   INIT_METHOD_CALL                                         !0, 'valid'
         14        DO_FCALL                                      0  $6      
         15      > JMPNZ                                                    $6, ->4
   10    16    > > RETURN                                                   1

Function gen:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/dTl8K
function name:  gen
number of ops:  15
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   GENERATOR_CREATE                                         
    3     1        INIT_FCALL                                               'var_dump'
          2        YIELD                                            $0      1
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                                 
    4     5        INIT_FCALL                                               'var_dump'
          6        YIELD                                            $2      -1
          7        SEND_VAR                                                 $2
          8        DO_ICALL                                                 
    5     9        INIT_FCALL                                               'var_dump'
         10        YIELD                                            $4      
         11        MUL                                              ~5      $4, -1
         12        SEND_VAL                                                 ~5
         13        DO_ICALL                                                 
    6    14      > GENERATOR_RETURN                                         

End of function gen

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.54 ms | 1390 KiB | 16 Q