3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Tr { public $s; public static $xx; /** * Tr constructor. * @param $s */ public function __construct($s) { $this->s = $s; } public function __destruct() { echo "__destruct $this->s" . PHP_EOL; } } function b() { $tr = new Tr('b'); echo 'b' . PHP_EOL; try { c($tr); } catch(\Exception $ex) { $tr::$xx = $ex; } // If exception thrown here, Tr::__destruct is called // throw new \Exception('ee'); // Or if you call c() without passing $tr, Tr::__destruct is called } /** * @param Tr $tr */ function c($tr = null) { throw new \Exception('ee'); } b();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K66dp
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   INIT_FCALL                                               'b'
          1        DO_FCALL                                      0          
   49     2      > RETURN                                                   1

Function b:
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: 9
Branch analysis from position: 9
2 jumps found. (Code = 107) Position 1 = 10, Position 2 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K66dp
function name:  b
number of ops:  14
compiled vars:  !0 = $tr, !1 = $ex
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $2      'Tr'
          1        SEND_VAL_EX                                              'b'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   26     4        ECHO                                                     'b%0A'
   28     5        INIT_FCALL_BY_NAME                                       'c'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
          8      > JMP                                                      ->13
   30     9  E > > CATCH                                       last         'Exception'
   31    10    >   FETCH_CLASS                                   0  $6      !0
         11        ASSIGN_STATIC_PROP                                       'xx', $6
         12        OP_DATA                                                  !1
   37    13    > > RETURN                                                   null

End of function b

Function c:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/K66dp
function name:  c
number of ops:  6
compiled vars:  !0 = $tr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   RECV_INIT                                        !0      null
   43     1        NEW                                              $1      'Exception'
          2        SEND_VAL_EX                                              'ee'
          3        DO_FCALL                                      0          
          4      > THROW                                         0          $1
   44     5*     > RETURN                                                   null

End of function c

Class Tr:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K66dp
function name:  __construct
number of ops:  4
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   15     1        ASSIGN_OBJ                                               's'
          2        OP_DATA                                                  !0
   16     3      > 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/K66dp
function name:  __destruct
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NOP                                                      
          1        FETCH_OBJ_R                                      ~0      's'
          2        FAST_CONCAT                                      ~1      '__destruct+', ~0
          3        CONCAT                                           ~2      ~1, '%0A'
          4        ECHO                                                     ~2
   21     5      > RETURN                                                   null

End of function __destruct

End of class Tr.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.78 ms | 1394 KiB | 14 Q