3v4l.org

run code in 500+ PHP versions simultaneously
<?php $xml = <<<END <?xml version="1.0" encoding="UTF-8"?> <root> <child attribute="value" /> <child hello="world" /> </root> END; $doc = new DOMDocument(); $doc->loadXML($xml); assert($doc->firstChild->childNodes[3]->attributes['hello'] === $doc->firstChild->childNodes->item(3)->attributes->getNamedItem('hello')); assert($doc->firstChild->childNodes[3]->attributes['hello']->nodeValue === 'world');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AGvek
function name:  (null)
number of ops:  40
compiled vars:  !0 = $xml, !1 = $doc
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%0A%3Croot%3E%0A++++%3Cchild+attribute%3D%22value%22+%2F%3E%0A++++%3Cchild+hello%3D%22world%22+%2F%3E%0A%3C%2Froot%3E'
   10     1        NEW                                                  $3      'DOMDocument'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !1, $3
   11     4        INIT_METHOD_CALL                                             !1, 'loadXML'
          5        SEND_VAR_EX                                                  !0
          6        DO_FCALL                                          0          
   13     7        ASSERT_CHECK                                                 
          8        INIT_FCALL                                                   'assert'
          9        FETCH_OBJ_R                                          ~7      !1, 'firstChild'
         10        FETCH_OBJ_R                                          ~8      ~7, 'childNodes'
         11        FETCH_DIM_R                                          ~9      ~8, 3
         12        FETCH_OBJ_R                                          ~10     ~9, 'attributes'
         13        FETCH_DIM_R                                          ~11     ~10, 'hello'
         14        FETCH_OBJ_R                                          ~12     !1, 'firstChild'
         15        FETCH_OBJ_R                                          ~13     ~12, 'childNodes'
         16        INIT_METHOD_CALL                                             ~13, 'item'
         17        SEND_VAL_EX                                                  3
         18        DO_FCALL                                          0  $14     
         19        FETCH_OBJ_R                                          ~15     $14, 'attributes'
         20        INIT_METHOD_CALL                                             ~15, 'getNamedItem'
         21        SEND_VAL_EX                                                  'hello'
         22        DO_FCALL                                          0  $16     
         23        IS_IDENTICAL                                         ~17     $16, ~11
         24        SEND_VAL                                                     ~17
         25        SEND_VAL                                                     'assert%28%24doc-%3EfirstChild-%3EchildNodes%5B3%5D-%3Eattributes%5B%27hello%27%5D+%3D%3D%3D+%24doc-%3EfirstChild-%3EchildNodes-%3Eitem%283%29-%3Eattributes-%3EgetNamedItem%28%27hello%27%29%29'
         26        DO_ICALL                                                     
   14    27        ASSERT_CHECK                                                 
         28        INIT_FCALL                                                   'assert'
         29        FETCH_OBJ_R                                          ~19     !1, 'firstChild'
         30        FETCH_OBJ_R                                          ~20     ~19, 'childNodes'
         31        FETCH_DIM_R                                          ~21     ~20, 3
         32        FETCH_OBJ_R                                          ~22     ~21, 'attributes'
         33        FETCH_DIM_R                                          ~23     ~22, 'hello'
         34        FETCH_OBJ_R                                          ~24     ~23, 'nodeValue'
         35        IS_IDENTICAL                                         ~25     ~24, 'world'
         36        SEND_VAL                                                     ~25
         37        SEND_VAL                                                     'assert%28%24doc-%3EfirstChild-%3EchildNodes%5B3%5D-%3Eattributes%5B%27hello%27%5D-%3EnodeValue+%3D%3D%3D+%27world%27%29'
         38        DO_ICALL                                                     
         39      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
126.53 ms | 482 KiB | 8 Q