3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<< HTML <!doctype html> <html> <head> <link rel="shortcut icon" href="https://google.com"/> </head> <body></body> </html> HTML; $doc = new DOMDocument; $doc->loadHtml($html); $xpath = new DomXPath($doc); echo $xpath->query('.//link[@rel="shortcut icon"]')->item(0)->getAttribute('href');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5YvCc
function name:  (null)
number of ops:  22
compiled vars:  !0 = $html, !1 = $doc, !2 = $xpath
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3C%21doctype+html%3E%0A%3Chtml%3E%0A++%3Chead%3E%0A++++%3Clink+rel%3D%22shortcut+icon%22+href%3D%22https%3A%2F%2Fgoogle.com%22%2F%3E%0A++%3C%2Fhead%3E%0A++%3Cbody%3E%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   13     1        NEW                                              $4      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $4
   14     4        INIT_METHOD_CALL                                         !1, 'loadHtml'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   16     7        NEW                                              $8      'DomXPath'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $8
   17    11        INIT_METHOD_CALL                                         !2, 'query'
         12        SEND_VAL_EX                                              '.%2F%2Flink%5B%40rel%3D%22shortcut+icon%22%5D'
         13        DO_FCALL                                      0  $11     
         14        INIT_METHOD_CALL                                         $11, 'item'
         15        SEND_VAL_EX                                              0
         16        DO_FCALL                                      0  $12     
         17        INIT_METHOD_CALL                                         $12, 'getAttribute'
         18        SEND_VAL_EX                                              'href'
         19        DO_FCALL                                      0  $13     
         20        ECHO                                                     $13
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.32 ms | 1393 KiB | 13 Q