3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fooGenerator() { try { foreach (range(0, 1000) as $key) { yield $key; } } finally { var_dump('Closed!'); } } $iterator = fooGenerator(); foreach ($iterator as $key) { throw new \Exception(); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/3jWqQ
function name:  (null)
number of ops:  11
compiled vars:  !0 = $iterator, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'foogenerator'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   18     3      > FE_RESET_R                                       $4      !0, ->9
          4    > > FE_FETCH_R                                               $4, !1, ->9
   19     5    >   NEW                                              $5      'Exception'
          6        DO_FCALL                                      0          
          7      > THROW                                         0          $5
   18     8*       JMP                                                      ->4
          9    >   FE_FREE                                                  $4
   20    10      > RETURN                                                   1

Function foogenerator:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 9
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 9
2 jumps found. (Code = 162) Position 1 = 12, Position 2 = 11
Branch analysis from position: 12
1 jumps found. (Code = 163) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 9
filename:       /in/3jWqQ
function name:  fooGenerator
number of ops:  17
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                         
    6     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 0
          3        SEND_VAL                                                 1000
          4        DO_ICALL                                         $2      
          5      > FE_RESET_R                                       $3      $2, ->9
          6    > > FE_FETCH_R                                               $3, !0, ->9
    7     7    >   YIELD                                                    !0
    6     8      > JMP                                                      ->6
          9    >   FE_FREE                                                  $3
    9    10      > FAST_CALL                                                ->12
         11    > > JMP                                                      ->16
   10    12    >   INIT_FCALL                                               'var_dump'
         13        SEND_VAL                                                 'Closed%21'
         14        DO_ICALL                                                 
         15      > FAST_RET                                                 
   13    16    > > GENERATOR_RETURN                                         

End of function foogenerator

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.84 ms | 1399 KiB | 18 Q