3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyNode extends DOMNode { public function describe() { echo "I am a " . $this->tagName . " node!"; } } class MyElement extends DOMElement {} class MyDocument extends DOMDocument {} $dom = new MyDocument(); $dom->registerNodeClass("DOMNode", "MyNode"); $dom->registerNodeClass("DOMElement", "MyElement"); $dom->loadHTML("<!doctype html><h1>Hello, World!</h1>"); var_dump(get_class($dom->documentElement)); var_dump($dom->documentElement->childNodes->item(0));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9OiE8
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      'MyDocument'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   14     3        INIT_METHOD_CALL                                         !0, 'registerNodeClass'
          4        SEND_VAL_EX                                              'DOMNode'
          5        SEND_VAL_EX                                              'MyNode'
          6        DO_FCALL                                      0          
   15     7        INIT_METHOD_CALL                                         !0, 'registerNodeClass'
          8        SEND_VAL_EX                                              'DOMElement'
          9        SEND_VAL_EX                                              'MyElement'
         10        DO_FCALL                                      0          
   17    11        INIT_METHOD_CALL                                         !0, 'loadHTML'
         12        SEND_VAL_EX                                              '%3C%21doctype+html%3E%3Ch1%3EHello%2C+World%21%3C%2Fh1%3E'
         13        DO_FCALL                                      0          
   19    14        INIT_FCALL                                               'var_dump'
         15        FETCH_OBJ_R                                      ~7      !0, 'documentElement'
         16        GET_CLASS                                        ~8      ~7
         17        SEND_VAL                                                 ~8
         18        DO_ICALL                                                 
   20    19        INIT_FCALL                                               'var_dump'
         20        FETCH_OBJ_R                                      ~10     !0, 'documentElement'
         21        FETCH_OBJ_R                                      ~11     ~10, 'childNodes'
         22        INIT_METHOD_CALL                                         ~11, 'item'
         23        SEND_VAL_EX                                              0
         24        DO_FCALL                                      0  $12     
         25        SEND_VAR                                                 $12
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Class MyNode:
Function describe:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9OiE8
function name:  describe
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FETCH_OBJ_R                                      ~0      'tagName'
          1        CONCAT                                           ~1      'I+am+a+', ~0
          2        CONCAT                                           ~2      ~1, '+node%21'
          3        ECHO                                                     ~2
    6     4      > RETURN                                                   null

End of function describe

End of class MyNode.

Class MyElement: [no user functions]
Class MyDocument: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
184.21 ms | 1396 KiB | 15 Q