3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = function() { try { yield 1; } finally { throw new Exception(); } }; $b = function() { yield 1; }; echo "starting " . phpversion() . "\n"; try { foreach ($a() as $x) { foreach ($b() as $y) { return true; } } } catch (Exception $e) { echo "caught exception.\n"; } echo "exit.\n";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 23
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 23
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 21
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 21
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
Found catch point at position: 25
Branch analysis from position: 25
2 jumps found. (Code = 107) Position 1 = 26, Position 2 = -2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/N5B6A
function name:  (null)
number of ops:  29
compiled vars:  !0 = $a, !1 = $b, !2 = $x, !3 = $y, !4 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FN5B6A%3A4%240'
          1        ASSIGN                                                   !0, ~5
   12     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FN5B6A%3A12%241'
          3        ASSIGN                                                   !1, ~7
   16     4        INIT_FCALL                                               'phpversion'
          5        DO_ICALL                                         $9      
          6        CONCAT                                           ~10     'starting+', $9
          7        CONCAT                                           ~11     ~10, '%0A'
          8        ECHO                                                     ~11
   18     9        INIT_DYNAMIC_CALL                                        !0
         10        DO_FCALL                                      0  $12     
         11      > FE_RESET_R                                       $13     $12, ->23
         12    > > FE_FETCH_R                                               $13, !2, ->23
   19    13    >   INIT_DYNAMIC_CALL                                        !1
         14        DO_FCALL                                      0  $14     
         15      > FE_RESET_R                                       $15     $14, ->21
         16    > > FE_FETCH_R                                               $15, !3, ->21
   20    17    >   FE_FREE                                                  $15
         18        FE_FREE                                                  $13
         19      > RETURN                                                   <true>
   19    20*       JMP                                                      ->16
         21    >   FE_FREE                                                  $15
   18    22      > JMP                                                      ->12
         23    >   FE_FREE                                                  $13
         24      > JMP                                                      ->27
   23    25  E > > CATCH                                       last         'Exception'
   24    26    >   ECHO                                                     'caught+exception.%0A'
   26    27    >   ECHO                                                     'exit.%0A'
         28      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FN5B6A%3A4%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 162) Position 1 = 4, Position 2 = 3
Branch analysis from position: 4
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/N5B6A
function name:  {closure}
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   GENERATOR_CREATE                                         
    6     1        YIELD                                                    1
    7     2      > FAST_CALL                                                ->4
          3    > > JMP                                                      ->8
    8     4    >   NEW                                              $2      'Exception'
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $2
          7*       FAST_RET                                                 
   10     8    > > GENERATOR_RETURN                                         

End of function %00%7Bclosure%7D%2Fin%2FN5B6A%3A4%240

Function %00%7Bclosure%7D%2Fin%2FN5B6A%3A12%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 161) Position 1 = -2
filename:       /in/N5B6A
function name:  {closure}
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   GENERATOR_CREATE                                         
   13     1        YIELD                                                    1
   14     2      > GENERATOR_RETURN                                         

End of function %00%7Bclosure%7D%2Fin%2FN5B6A%3A12%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.67 ms | 1400 KiB | 15 Q