3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Tr { public $s; /** * 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; c($tr); // 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/js4iU
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   INIT_FCALL                                               'b'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   1

Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/js4iU
function name:  b
number of ops:  13
compiled vars:  !0 = $tr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   NEW                                              $1      'Tr'
          1        SEND_VAL_EX                                              'b'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   24     4        ECHO                                                     'b%0A'
   25     5        INIT_FCALL_BY_NAME                                       'c'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
   27     8        NEW                                              $5      'Exception'
          9        SEND_VAL_EX                                              'ee'
         10        DO_FCALL                                      0          
         11      > THROW                                         0          $5
   29    12*     > RETURN                                                   null

End of function b

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

End of function __destruct

End of class Tr.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.21 ms | 1403 KiB | 14 Q