3v4l.org

run code in 500+ PHP versions simultaneously
<?php $html = '<!DOCTYPE html><html><head> <noscript> <style>body { margin: 0; }</style> </noscript> <link href="/style.css" rel="stylesheet"> </head><body></body></html>'; $doc = Dom\HTMLDocument::createFromString($html, LIBXML_NOERROR); echo $doc->saveHTML(), PHP_EOL; $link = $doc->getElementsByTagName('link')->item(0); echo "Link parent: ", $link->parentNode->nodeName, PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TmBjH
function name:  (null)
number of ops:  23
compiled vars:  !0 = $html, !1 = $doc, !2 = $link
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%3C%21DOCTYPE+html%3E%3Chtml%3E%3Chead%3E%0A%3Cnoscript%3E%0A++++%3Cstyle%3Ebody+%7B+margin%3A+0%3B+%7D%3C%2Fstyle%3E%0A%3C%2Fnoscript%3E%0A%3Clink+href%3D%22%2Fstyle.css%22+rel%3D%22stylesheet%22%3E%0A%3C%2Fhead%3E%3Cbody%3E%3C%2Fbody%3E%3C%2Fhtml%3E'
   10     1        INIT_STATIC_METHOD_CALL                                      'Dom%5CHTMLDocument', 'createFromString'
          2        SEND_VAR                                                     !0
          3        SEND_VAL                                                     32
          4        DO_FCALL                                          0  $4      
          5        ASSIGN                                                       !1, $4
   11     6        INIT_METHOD_CALL                                             !1, 'saveHTML'
          7        DO_FCALL                                          0  $6      
          8        ECHO                                                         $6
          9        ECHO                                                         '%0A'
   13    10        INIT_METHOD_CALL                                             !1, 'getElementsByTagName'
         11        SEND_VAL_EX                                                  'link'
         12        DO_FCALL                                          0  $7      
         13        INIT_METHOD_CALL                                             $7, 'item'
         14        SEND_VAL_EX                                                  0
         15        DO_FCALL                                          0  $8      
         16        ASSIGN                                                       !2, $8
   14    17        ECHO                                                         'Link+parent%3A+'
         18        FETCH_OBJ_R                                          ~10     !2, 'parentNode'
         19        FETCH_OBJ_R                                          ~11     ~10, 'nodeName'
         20        ECHO                                                         ~11
         21        ECHO                                                         '%0A'
   15    22      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
152.37 ms | 1127 KiB | 13 Q