3v4l.org

run code in 300+ PHP versions simultaneously
<?php class PreviousException extends \Exception {} class One extends \RuntimeException { // Just a standard exception } class Two extends \RuntimeException{ // An exception with custom constructor parameters public function __construct($customMessage, PreviousException $e) { parent::__construct($customMessage . "LOL", $e->getCode(), $e); } } try { throw new Two('Throwing "Two", but catch will receive a different class type if I specify just "\Exception" in the catch statement not "Two"', new PreviousException()); } catch (\Exception $e) { var_dump($e); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
Found catch point at position: 8
Branch analysis from position: 8
2 jumps found. (Code = 107) Position 1 = 9, Position 2 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h7WFL
function name:  (null)
number of ops:  13
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $1      'Two'
          1        SEND_VAL_EX                                              'Throwing+%22Two%22%2C+but+catch+will+receive+a+different+class+type+if+I+specify+just+%22%5CException%22+in+the+catch+statement+not+%22Two%22'
          2        NEW                                              $2      'PreviousException'
          3        DO_FCALL                                      0          
          4        SEND_VAR_NO_REF_EX                                       $2
          5        DO_FCALL                                      0          
          6      > THROW                                         0          $1
          7*       JMP                                                      ->12
   21     8  E > > CATCH                                       last         'Exception'
   22     9    >   INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
   23    12      > RETURN                                                   1

Class PreviousException: [no user functions]
Class One: [no user functions]
Class Two:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h7WFL
function name:  __construct
number of ops:  11
compiled vars:  !0 = $customMessage, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2        INIT_STATIC_METHOD_CALL                                  
          3        CONCAT                                           ~2      !0, 'LOL'
          4        SEND_VAL_EX                                              ~2
          5        INIT_METHOD_CALL                                         !1, 'getCode'
          6        DO_FCALL                                      0  $3      
          7        SEND_VAR_NO_REF_EX                                       $3
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
   15    10      > RETURN                                                   null

End of function __construct

End of class Two.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.54 ms | 1396 KiB | 15 Q