3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Destructable { private $id; function __construct($id) { $this->id = $id; } function __destruct() { echo "Goodbye ($this->id)!\n"; } } function throwaway($anything) { throw new Exception; } $stored_exception = null; try { $parameter = new Destructable(1); $not_a_parameter = new Destructable(2); throwaway( $parameter ); } catch ( Exception $e ) { echo "Caught!\n"; // $stored_exception = $e; } echo "Unsetting...\n"; unset($stored_exception);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 13
Branch analysis from position: 13
2 jumps found. (Code = 107) Position 1 = 14, Position 2 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dHBV6
function name:  (null)
number of ops:  18
compiled vars:  !0 = $stored_exception, !1 = $parameter, !2 = $not_a_parameter, !3 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                   !0, null
   15     1        NEW                                              $5      'Destructable'
          2        SEND_VAL_EX                                              1
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $5
   16     5        NEW                                              $8      'Destructable'
          6        SEND_VAL_EX                                              2
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $8
   17     9        INIT_FCALL                                               'throwaway'
         10        SEND_VAR                                                 !1
         11        DO_FCALL                                      0          
         12      > JMP                                                      ->15
   19    13  E > > CATCH                                       last         'Exception'
   21    14    >   ECHO                                                     'Caught%21%0A'
   25    15    >   ECHO                                                     'Unsetting...%0A'
   26    16        UNSET_CV                                                 !0
         17      > RETURN                                                   1

Function throwaway:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/dHBV6
function name:  throwaway
number of ops:  5
compiled vars:  !0 = $anything
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        NEW                                              $1      'Exception'
          2        DO_FCALL                                      0          
          3      > THROW                                         0          $1
          4*     > RETURN                                                   null

End of function throwaway

Class Destructable:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dHBV6
function name:  __construct
number of ops:  4
compiled vars:  !0 = $id
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'id'
          2        OP_DATA                                                  !0
          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/dHBV6
function name:  __destruct
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ROPE_INIT                                     3  ~2      'Goodbye+%28'
          1        FETCH_OBJ_R                                      ~0      'id'
          2        ROPE_ADD                                      1  ~2      ~2, ~0
          3        ROPE_END                                      2  ~1      ~2, '%29%21%0A'
          4        ECHO                                                     ~1
          5      > RETURN                                                   null

End of function __destruct

End of class Destructable.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.4 ms | 1403 KiB | 14 Q