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) { break; } foreach ($iterator as $key) { dd($key); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
Branch analysis from position: 7
Branch analysis from position: 7
filename:       /in/Zv4qc
function name:  (null)
number of ops:  16
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, ->7
          4    > > FE_FETCH_R                                               $4, !1, ->7
   19     5    > > JMP                                                      ->7
   18     6*       JMP                                                      ->4
          7    >   FE_FREE                                                  $4
   22     8      > FE_RESET_R                                       $5      !0, ->14
          9    > > FE_FETCH_R                                               $5, !1, ->14
   23    10    >   INIT_FCALL_BY_NAME                                       'dd'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0          
   22    13      > JMP                                                      ->9
         14    >   FE_FREE                                                  $5
   24    15      > 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/Zv4qc
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:
154.03 ms | 1403 KiB | 18 Q