3v4l.org

run code in 500+ PHP versions simultaneously
<?php class MyAttr extends DOMAttr { public function __construct() { echo "constructor\n"; } public function __destruct() { echo "destructor\n"; } } $dom = new DOMDocument; $dom->registerNodeClass("DOMAttr", "MyAttr"); $dom->loadXML('<container foo="bar"/>'); var_dump($dom->documentElement->attributes[0]->name);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/S4jOY
function name:  (null)
number of ops:  18
compiled vars:  !0 = $dom
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   NEW                                                  $1      'DOMDocument'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   13     3        INIT_METHOD_CALL                                             !0, 'registerNodeClass'
          4        SEND_VAL_EX                                                  'DOMAttr'
          5        SEND_VAL_EX                                                  'MyAttr'
          6        DO_FCALL                                          0          
   14     7        INIT_METHOD_CALL                                             !0, 'loadXML'
          8        SEND_VAL_EX                                                  '%3Ccontainer+foo%3D%22bar%22%2F%3E'
          9        DO_FCALL                                          0          
   15    10        INIT_FCALL                                                   'var_dump'
         11        FETCH_OBJ_R                                          ~6      !0, 'documentElement'
         12        FETCH_OBJ_R                                          ~7      ~6, 'attributes'
         13        FETCH_DIM_R                                          ~8      ~7, 0
         14        FETCH_OBJ_R                                          ~9      ~8, 'name'
         15        SEND_VAL                                                     ~9
         16        DO_ICALL                                                     
         17      > RETURN                                                       1

Class MyAttr:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/S4jOY
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                         'constructor%0A'
    6     1      > 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/S4jOY
function name:  __destruct
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   ECHO                                                         'destructor%0A'
    9     1      > RETURN                                                       null

End of function __destruct

End of class MyAttr.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.65 ms | 1772 KiB | 14 Q