3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Z { public function __destruct() { throw new Exception('destruct Z'); } } class A { private $m; public function __construct() { $this->m = new Z(); } public function __destruct() { #throw new Exception('destruct A'); } } class B { public function abc() { $a = new A(); } public function __destruct() { throw new Exception('destruct B'); } } try { try { { $b = new B(); try { $b->abc(); } catch (Exception $e) { echo '1: ' . $e->getMessage() . "\n"; } unset($b); } } catch (Exception $e) { echo '2: ' . $e->getMessage() . "\n"; } } catch (Exception $e) { echo '3: ' . $e->getMessage() . "\n"; } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 6
Branch analysis from position: 6
2 jumps found. (Code = 107) Position 1 = 7, Position 2 = -2
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Found catch point at position: 14
Branch analysis from position: 14
2 jumps found. (Code = 107) Position 1 = 15, Position 2 = -2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Found catch point at position: 21
Branch analysis from position: 21
2 jumps found. (Code = 107) Position 1 = 22, Position 2 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2ieOh
function name:  (null)
number of ops:  28
compiled vars:  !0 = $b, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   NEW                                              $2      'B'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   44     3        INIT_METHOD_CALL                                         !0, 'abc'
          4        DO_FCALL                                      0          
          5      > JMP                                                      ->12
   47     6  E > > CATCH                                       last         'Exception'
   48     7    >   INIT_METHOD_CALL                                         !1, 'getMessage'
          8        DO_FCALL                                      0  $6      
          9        CONCAT                                           ~7      '1%3A+', $6
         10        CONCAT                                           ~8      ~7, '%0A'
         11        ECHO                                                     ~8
   51    12    >   UNSET_CV                                                 !0
         13      > JMP                                                      ->20
   54    14  E > > CATCH                                       last         'Exception'
   55    15    >   INIT_METHOD_CALL                                         !1, 'getMessage'
         16        DO_FCALL                                      0  $9      
         17        CONCAT                                           ~10     '2%3A+', $9
         18        CONCAT                                           ~11     ~10, '%0A'
         19        ECHO                                                     ~11
         20    > > JMP                                                      ->27
   58    21  E > > CATCH                                       last         'Exception'
   59    22    >   INIT_METHOD_CALL                                         !1, 'getMessage'
         23        DO_FCALL                                      0  $12     
         24        CONCAT                                           ~13     '3%3A+', $12
         25        CONCAT                                           ~14     ~13, '%0A'
         26        ECHO                                                     ~14
   62    27    > > RETURN                                                   1

Class Z:
Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/2ieOh
function name:  __destruct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   NEW                                              $0      'Exception'
          1        SEND_VAL_EX                                              'destruct+Z'
          2        DO_FCALL                                      0          
          3      > THROW                                         0          $0
    7     4*     > RETURN                                                   null

End of function __destruct

End of class Z.

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2ieOh
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $1      'Z'
          1        DO_FCALL                                      0          
          2        ASSIGN_OBJ                                               'm'
          3        OP_DATA                                                  $1
   18     4      > RETURN                                                   null

End of function __construct

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2ieOh
function name:  __destruct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E > > RETURN                                                   null

End of function __destruct

End of class A.

Class B:
Function abc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2ieOh
function name:  abc
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   30     3      > RETURN                                                   null

End of function abc

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/2ieOh
function name:  __destruct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   NEW                                              $0      'Exception'
          1        SEND_VAL_EX                                              'destruct+B'
          2        DO_FCALL                                      0          
          3      > THROW                                         0          $0
   35     4*     > RETURN                                                   null

End of function __destruct

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.73 ms | 1399 KiB | 13 Q