3v4l.org

run code in 500+ PHP versions simultaneously
<?php function generate() { try { yield 1; yield 2; } catch(\Exception $e) { echo 'catch'; } finally { echo "finally\n"; } } try { foreach (generate() as $i) { echo $i, "\n"; exit(0); } } catch(Exception $e) { echo 'outer catch'; } finally { echo "outer finally\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
1 jumps found. (Code = 61) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 162) Position 1 = 16, Position 2 = 15
Branch analysis from position: 16
1 jumps found. (Code = 163) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
Found catch point at position: 12
Branch analysis from position: 12
2 jumps found. (Code = 107) Position 1 = 13, Position 2 = -2
Branch analysis from position: 13
2 jumps found. (Code = 162) Position 1 = 16, Position 2 = 15
Branch analysis from position: 16
Branch analysis from position: 15
filename:       /in/HGKHS
function name:  (null)
number of ops:  19
compiled vars:  !0 = $i, !1 = $e
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                                   'generate'
          1        DO_FCALL                                          0  $3      
          2      > FE_RESET_R                                           $4      $3, ->10
          3    > > FE_FETCH_R                                                   $4, !0, ->10
   17     4    >   ECHO                                                         !0
          5        ECHO                                                         '%0A'
   18     6      > INIT_FCALL                                                   'exit'
          7*       SEND_VAL                                                     0
          8*       DO_ICALL                                                     
   16     9*       JMP                                                          ->3
         10    >   FE_FREE                                                      $4
         11      > JMP                                                          ->14
   20    12  E > > CATCH                                           last         'Exception'
   21    13    >   ECHO                                                         'outer+catch'
   22    14    > > FAST_CALL                                                    ->16
         15    > > JMP                                                          ->18
   23    16    >   ECHO                                                         'outer+finally%0A'
         17      > FAST_RET                                                     
   24    18    > > RETURN                                                       1

Function generate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
2 jumps found. (Code = 162) Position 1 = 8, Position 2 = 7
Branch analysis from position: 8
1 jumps found. (Code = 163) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 161) Position 1 = -2
Found catch point at position: 4
Branch analysis from position: 4
2 jumps found. (Code = 107) Position 1 = 5, Position 2 = -2
Branch analysis from position: 5
2 jumps found. (Code = 162) Position 1 = 8, Position 2 = 7
Branch analysis from position: 8
Branch analysis from position: 7
filename:       /in/HGKHS
function name:  generate
number of ops:  11
compiled vars:  !0 = $e
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   GENERATOR_CREATE                                             
    6     1        YIELD                                                        1
    7     2        YIELD                                                        2
          3      > JMP                                                          ->6
    8     4  E > > CATCH                                           last         'Exception'
    9     5    >   ECHO                                                         'catch'
   10     6    > > FAST_CALL                                                    ->8
          7    > > JMP                                                          ->10
   11     8    >   ECHO                                                         'finally%0A'
          9      > FAST_RET                                                     
   13    10    > > GENERATOR_RETURN                                             

End of function generate

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
166.98 ms | 3298 KiB | 16 Q