3v4l.org

run code in 300+ PHP versions simultaneously
<?php // vim: ts=3 sw=3 sts=3 et $body = file_get_contents('http://www.google.com'); libxml_use_internal_errors(true); $dom = new DOMDocument; $dom->loadHTML($body); $xpath = new DOMXPath($dom); $found = $xpath->query( '//a[ not(starts-with(normalize-space(@href), "http://")) and not(starts-with(normalize-space(@href), "https://")) ]'); header('content-type: text/plain'); foreach ($found as $node) { var_dump($node->getAttribute('href')); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 25, Position 2 = 33
Branch analysis from position: 25
2 jumps found. (Code = 78) Position 1 = 26, Position 2 = 33
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/pUIqd
function name:  (null)
number of ops:  35
compiled vars:  !0 = $body, !1 = $dom, !2 = $xpath, !3 = $found, !4 = $node
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'file_get_contents'
          1        SEND_VAL                                                 'http%3A%2F%2Fwww.google.com'
          2        DO_ICALL                                         $5      
          3        ASSIGN                                                   !0, $5
    5     4        INIT_FCALL                                               'libxml_use_internal_errors'
          5        SEND_VAL                                                 <true>
          6        DO_ICALL                                                 
    7     7        NEW                                              $8      'DOMDocument'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $8
    8    10        INIT_METHOD_CALL                                         !1, 'loadHTML'
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0          
   10    13        NEW                                              $12     'DOMXPath'
         14        SEND_VAR_EX                                              !1
         15        DO_FCALL                                      0          
         16        ASSIGN                                                   !2, $12
   11    17        INIT_METHOD_CALL                                         !2, 'query'
   12    18        SEND_VAL_EX                                              '%2F%2Fa%5B%0A+++not%28starts-with%28normalize-space%28%40href%29%2C+%22http%3A%2F%2F%22%29%29+and%0A+++not%28starts-with%28normalize-space%28%40href%29%2C+%22https%3A%2F%2F%22%29%29%0A%5D'
         19        DO_FCALL                                      0  $15     
   11    20        ASSIGN                                                   !3, $15
   17    21        INIT_FCALL                                               'header'
         22        SEND_VAL                                                 'content-type%3A+text%2Fplain'
         23        DO_ICALL                                                 
   18    24      > FE_RESET_R                                       $18     !3, ->33
         25    > > FE_FETCH_R                                               $18, !4, ->33
   20    26    >   INIT_FCALL                                               'var_dump'
         27        INIT_METHOD_CALL                                         !4, 'getAttribute'
         28        SEND_VAL_EX                                              'href'
         29        DO_FCALL                                      0  $19     
         30        SEND_VAR                                                 $19
         31        DO_ICALL                                                 
   18    32      > JMP                                                      ->25
         33    >   FE_FREE                                                  $18
   21    34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.09 ms | 1396 KiB | 21 Q