3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo(){ try { throw new Exception('Foo'); } finally { throw new Exception('Bar', 0, new Exception("This grabs the previous exception.")); } } try { foo(); } catch(Exception $exception) { while ($exception = $exception->getPrevious()) { echo $exception->getMessage().PHP_EOL; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 3
Branch analysis from position: 3
2 jumps found. (Code = 107) Position 1 = 4, Position 2 = -2
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 5
Branch analysis from position: 13
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 5
Branch analysis from position: 13
Branch analysis from position: 5
filename:       /in/f7TPO
function name:  (null)
number of ops:  14
compiled vars:  !0 = $exception
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'foo'
          1        DO_FCALL                                      0          
          2      > JMP                                                      ->13
   17     3  E > > CATCH                                       last         'Exception'
   18     4    > > JMP                                                      ->9
   19     5    >   INIT_METHOD_CALL                                         !0, 'getMessage'
          6        DO_FCALL                                      0  $2      
          7        CONCAT                                           ~3      $2, '%0A'
          8        ECHO                                                     ~3
   18     9    >   INIT_METHOD_CALL                                         !0, 'getPrevious'
         10        DO_FCALL                                      0  $4      
         11        ASSIGN                                           ~5      !0, $4
         12      > JMPNZ                                                    ~5, ->5
   21    13    > > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/f7TPO
function name:  foo
number of ops:  17
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   NEW                                              $1      'Exception'
          1        SEND_VAL_EX                                              'Foo'
          2        DO_FCALL                                      0          
          3      > THROW                                         0          $1
    8     4*       FAST_CALL                                                ->6
          5*       JMP                                                      ->16
    9     6*       NEW                                              $3      'Exception'
          7*       SEND_VAL_EX                                              'Bar'
          8*       SEND_VAL_EX                                              0
          9*       NEW                                              $4      'Exception'
         10*       SEND_VAL_EX                                              'This+grabs+the+previous+exception.'
         11*       DO_FCALL                                      0          
         12*       SEND_VAR_NO_REF_EX                                       $4
         13*       DO_FCALL                                      0          
         14*       THROW                                         0          $3
         15*       FAST_RET                                                 
   12    16*     > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.67 ms | 1402 KiB | 15 Q