3v4l.org

run code in 500+ PHP versions simultaneously
<?php class MyDbException extends Exception {} class DB { public function __construct() { $this->checkConnection(); } public function checkConnection() { try { $this->connect(); } catch (PDOException $e) { throw new MyDbException('Error during connection check', 42, $e); } } public function connect() { // Здесь будет подключение к Oracle DB через PDO throw new PDOException("SQLSTATE[28000] [1045] Access denied for user 'user'@'example.com' (using password: YES)"); } } function connectToDb() { try { $db = new DB; // ... } catch (MyDbException $e) { echo $e->getMessage(), ':', PHP_EOL, $e->getPrevious()->getMessage(), PHP_EOL; } catch (Exception $e) { echo $e->getMessage(), PHP_EOL; } } connectToDb();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IYuPv
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   39     0  E >   INIT_FCALL                                                   'connecttodb'
          1        DO_FCALL                                          0          
          2      > RETURN                                                       1

Function connecttodb:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
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 = 17
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 17
2 jumps found. (Code = 107) Position 1 = 18, Position 2 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 17
Branch analysis from position: 17
filename:       /in/IYuPv
function name:  connectToDb
number of ops:  23
compiled vars:  !0 = $db, !1 = $e
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   28     0  E >   NEW                                                  $2      'DB'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
          3      > JMP                                                          ->22
   31     4  E > > CATCH                                                        'MyDbException', ->17
   32     5    >   INIT_METHOD_CALL                                             !1, 'getMessage'
          6        DO_FCALL                                          0  $5      
          7        ECHO                                                         $5
          8        ECHO                                                         '%3A'
          9        ECHO                                                         '%0A'
         10        INIT_METHOD_CALL                                             !1, 'getPrevious'
         11        DO_FCALL                                          0  $6      
         12        INIT_METHOD_CALL                                             $6, 'getMessage'
         13        DO_FCALL                                          0  $7      
         14        ECHO                                                         $7
         15        ECHO                                                         '%0A'
         16      > JMP                                                          ->22
   34    17  E > > CATCH                                           last         'Exception'
   35    18    >   INIT_METHOD_CALL                                             !1, 'getMessage'
         19        DO_FCALL                                          0  $8      
         20        ECHO                                                         $8
         21        ECHO                                                         '%0A'
   37    22    > > RETURN                                                       null

End of function connecttodb

Class MyDbException: [no user functions]
Class DB:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IYuPv
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   INIT_METHOD_CALL                                             'checkConnection'
          1        DO_FCALL                                          0          
    9     2      > RETURN                                                       null

End of function __construct

Function checkconnection:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
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 = 108) Position 1 = -2
filename:       /in/IYuPv
function name:  checkConnection
number of ops:  11
compiled vars:  !0 = $e
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   INIT_METHOD_CALL                                             'connect'
          1        DO_FCALL                                          0          
          2      > JMP                                                          ->10
   15     3  E > > CATCH                                           last         'PDOException'
   16     4    >   NEW                                                  $2      'MyDbException'
          5        SEND_VAL_EX                                                  'Error+during+connection+check'
          6        SEND_VAL_EX                                                  42
          7        SEND_VAR_EX                                                  !0
          8        DO_FCALL                                          0          
          9      > THROW                                             0          $2
   18    10    > > RETURN                                                       null

End of function checkconnection

Function connect:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/IYuPv
function name:  connect
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   22     0  E >   NEW                                                  $0      'PDOException'
          1        SEND_VAL_EX                                                  'SQLSTATE%5B28000%5D+%5B1045%5D+Access+denied+for+user+%27user%27%40%27example.com%27+%28using+password%3A+YES%29'
          2        DO_FCALL                                          0          
          3      > THROW                                             0          $0
   23     4*     > RETURN                                                       null

End of function connect

End of class DB.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
273.27 ms | 2134 KiB | 14 Q