3v4l.org

run code in 500+ PHP versions simultaneously
<?php $document = new DOMDocument(); $document->appendChild($document->createElement('foo')); // add attribute in namespace $document->documentElement->setAttributeNS('urn:foo', 'f:foo', 'bar'); echo $document->saveXML(); // fetch the namespace definition node $namespace = $document->documentElement->getAttributeNodeNS('http://www.w3.org/2000/xmlns/', 'f'); var_dump($namespace); // it should be an attribute node but isn't $document->documentElement->removeAttributeNode($namespace);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jkC5s
function name:  (null)
number of ops:  32
compiled vars:  !0 = $document, !1 = $namespace
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   NEW                                                  $2      'DOMDocument'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
    4     3        INIT_METHOD_CALL                                             !0, 'appendChild'
          4        INIT_METHOD_CALL                                             !0, 'createElement'
          5        SEND_VAL_EX                                                  'foo'
          6        DO_FCALL                                          0  $5      
          7        SEND_VAR_NO_REF_EX                                           $5
          8        DO_FCALL                                          0          
    6     9        FETCH_OBJ_R                                          ~7      !0, 'documentElement'
         10        INIT_METHOD_CALL                                             ~7, 'setAttributeNS'
         11        SEND_VAL_EX                                                  'urn%3Afoo'
         12        SEND_VAL_EX                                                  'f%3Afoo'
         13        SEND_VAL_EX                                                  'bar'
         14        DO_FCALL                                          0          
    7    15        INIT_METHOD_CALL                                             !0, 'saveXML'
         16        DO_FCALL                                          0  $9      
         17        ECHO                                                         $9
   10    18        FETCH_OBJ_R                                          ~10     !0, 'documentElement'
         19        INIT_METHOD_CALL                                             ~10, 'getAttributeNodeNS'
         20        SEND_VAL_EX                                                  'http%3A%2F%2Fwww.w3.org%2F2000%2Fxmlns%2F'
         21        SEND_VAL_EX                                                  'f'
         22        DO_FCALL                                          0  $11     
         23        ASSIGN                                                       !1, $11
   11    24        INIT_FCALL                                                   'var_dump'
         25        SEND_VAR                                                     !1
         26        DO_ICALL                                                     
   14    27        FETCH_OBJ_R                                          ~14     !0, 'documentElement'
         28        INIT_METHOD_CALL                                             ~14, 'removeAttributeNode'
         29        SEND_VAR_EX                                                  !1
         30        DO_FCALL                                          0          
         31      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.42 ms | 2180 KiB | 14 Q