3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyElement extends DOMElement { } $dom = new DOMDocument(); $dom->registerNodeClass('DOMElement', 'myElement'); $e = new MyElement("e"); $dom->appendChild($e); // Gives MyElement echo get_class($dom->childNodes->item(0)) . "\n"; $e = null; // Gives DOMElement echo get_class($dom->childNodes->item(0)) . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ws77T
function name:  (null)
number of ops:  30
compiled vars:  !0 = $dom, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   NEW                                              $2      'DOMDocument'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    5     3        INIT_METHOD_CALL                                         !0, 'registerNodeClass'
          4        SEND_VAL_EX                                              'DOMElement'
          5        SEND_VAL_EX                                              'myElement'
          6        DO_FCALL                                      0          
    6     7        NEW                                              $6      'MyElement'
          8        SEND_VAL_EX                                              'e'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $6
    7    11        INIT_METHOD_CALL                                         !0, 'appendChild'
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0          
    9    14        FETCH_OBJ_R                                      ~10     !0, 'childNodes'
         15        INIT_METHOD_CALL                                         ~10, 'item'
         16        SEND_VAL_EX                                              0
         17        DO_FCALL                                      0  $11     
         18        GET_CLASS                                        ~12     $11
         19        CONCAT                                           ~13     ~12, '%0A'
         20        ECHO                                                     ~13
   10    21        ASSIGN                                                   !1, null
   13    22        FETCH_OBJ_R                                      ~15     !0, 'childNodes'
         23        INIT_METHOD_CALL                                         ~15, 'item'
         24        SEND_VAL_EX                                              0
         25        DO_FCALL                                      0  $16     
         26        GET_CLASS                                        ~17     $16
         27        CONCAT                                           ~18     ~17, '%0A'
         28        ECHO                                                     ~18
         29      > RETURN                                                   1

Class MyElement: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.7 ms | 1394 KiB | 13 Q