3v4l.org

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

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

End of function __get

End of class MyElement.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.66 ms | 1395 KiB | 15 Q