3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CustomException extends Exception { public $object; public function __construct(string $msg, SomeClass $object) { $this->object = $object; parent::__construct($msg); } } class SomeClass { public function __construct() { throw new CustomException("Invalid parameters!", $this); } } try { $a = new SomeClass(); } catch (CustomException $e) { $a = $e->object; } var_dump($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
1 jumps found. (Code = 62) 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
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pbIWR
function name:  (null)
number of ops:  11
compiled vars:  !0 = $a, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $2      'SomeClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
          3      > JMP                                                      ->7
   24     4  E > > CATCH                                       last         'CustomException'
   25     5    >   FETCH_OBJ_R                                      ~5      !1, 'object'
          6        ASSIGN                                                   !0, ~5
   28     7    >   INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Class CustomException:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pbIWR
function name:  __construct
number of ops:  8
compiled vars:  !0 = $msg, !1 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        ASSIGN_OBJ                                               'object'
          3        OP_DATA                                                  !1
   10     4        INIT_STATIC_METHOD_CALL                                  
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   11     7      > RETURN                                                   null

End of function __construct

End of class CustomException.

Class SomeClass:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/pbIWR
function name:  __construct
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $0      'CustomException'
          1        SEND_VAL_EX                                              'Invalid+parameters%21'
          2        FETCH_THIS                                       $1      
          3        SEND_VAR_EX                                              $1
          4        DO_FCALL                                      0          
          5      > THROW                                         0          $0
   19     6*     > RETURN                                                   null

End of function __construct

End of class SomeClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.5 ms | 1446 KiB | 14 Q