3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyElement extends \DOMElement { public function __get($name) { return $this->$name; } } class MyTextNode extends \DOMText { public function __get($name) { return $this->$name; } } $dom = new DOMDocument(); $dom->registerNodeClass('DOMElement', 'MyElement'); $dom->registerNodeClass('DOMText', 'MyTextNode'); $dom->appendChild($dom->createElement('Foo', 'Bar')); var_dump( $dom->documentElement ); var_dump( $dom->documentElement->nodeValue );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CThTQ
function name:  (null)
number of ops:  28
compiled vars:  !0 = $dom
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $1      'DOMDocument'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   14     3        INIT_METHOD_CALL                                         !0, 'registerNodeClass'
          4        SEND_VAL_EX                                              'DOMElement'
          5        SEND_VAL_EX                                              'MyElement'
          6        DO_FCALL                                      0          
   15     7        INIT_METHOD_CALL                                         !0, 'registerNodeClass'
          8        SEND_VAL_EX                                              'DOMText'
          9        SEND_VAL_EX                                              'MyTextNode'
         10        DO_FCALL                                      0          
   16    11        INIT_METHOD_CALL                                         !0, 'appendChild'
         12        INIT_METHOD_CALL                                         !0, 'createElement'
         13        SEND_VAL_EX                                              'Foo'
         14        SEND_VAL_EX                                              'Bar'
         15        DO_FCALL                                      0  $6      
         16        SEND_VAR_NO_REF_EX                                       $6
         17        DO_FCALL                                      0          
   18    18        INIT_FCALL                                               'var_dump'
   19    19        FETCH_OBJ_R                                      ~8      !0, 'documentElement'
         20        SEND_VAL                                                 ~8
         21        DO_ICALL                                                 
   21    22        INIT_FCALL                                               'var_dump'
   22    23        FETCH_OBJ_R                                      ~10     !0, 'documentElement'
         24        FETCH_OBJ_R                                      ~11     ~10, 'nodeValue'
         25        SEND_VAL                                                 ~11
         26        DO_ICALL                                                 
   23    27      > RETURN                                                   1

Class MyElement:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CThTQ
function name:  __get
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        FETCH_OBJ_R                                      ~1      !0
          2      > RETURN                                                   ~1
    5     3*     > RETURN                                                   null

End of function __get

End of class MyElement.

Class MyTextNode:
Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CThTQ
function name:  __get
number of ops:  4
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        FETCH_OBJ_R                                      ~1      !0
          2      > RETURN                                                   ~1
   10     3*     > RETURN                                                   null

End of function __get

End of class MyTextNode.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.5 ms | 1400 KiB | 15 Q