3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hrefPattern = '/<a\\s+[^>]*href=(["\']??)[^"\'>]*?\\2([^>]*)>.*<\\/a>/siU'; $html = <<<HTML <p>If you find any cases where this code falls down, let us know using the Feedback link below.</p> <p>Before using this or similar scripts to fetch pages from other websites, we suggest you read through the related article on <a href="/php/parse-robots/" title="foobar" target="_parent">setting a user agent and parsing robots.txt</a>.</p> <h2>First checking robots.txt</h2> <p>As mentioned above, before using a script to download files you should always <a target="_blank" href="/php/parse-robots/">check the robots.txt file</a>. Here we're making use of the <tt>robots_allowed</tt> function from the article linked above to determine whether we're allowed to access files:</p> <p>As mentioned above, before using a script to download files you should always <a href="/php/parse-robots/">check the robots.txt file</a>. Here we're making use of the <tt>robots_allowed</tt> function from the article linked above to determine whether we're allowed to access files:</p> HTML; preg_match_all($hrefPattern, $html, $matches, PREG_SET_ORDER ^ PREG_OFFSET_CAPTURE); var_dump($matches);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/d1hGG
function name:  (null)
number of ops:  12
compiled vars:  !0 = $hrefPattern, !1 = $html, !2 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%2F%3Ca%5Cs%2B%5B%5E%3E%5D%2Ahref%3D%28%5B%22%27%5D%3F%3F%29%5B%5E%22%27%3E%5D%2A%3F%5C2%28%5B%5E%3E%5D%2A%29%3E.%2A%3C%5C%2Fa%3E%2FsiU'
    5     1        ASSIGN                                                   !1, '%3Cp%3EIf+you+find+any+cases+where+this+code+falls+down%2C+let+us+know+using%0Athe+Feedback+link+below.%3C%2Fp%3E%0A%0A%3Cp%3EBefore+using+this+or+similar+scripts+to+fetch+pages+from+other%0Awebsites%2C+we+suggest+you+read+through+the+related+article+on+%3Ca+href%3D%22%2Fphp%2Fparse-robots%2F%22+title%3D%22foobar%22+target%3D%22_parent%22%3Esetting+a+user+agent+and+parsing+robots.txt%3C%2Fa%3E.%3C%2Fp%3E%0A%0A%0A%3Ch2%3EFirst+checking+robots.txt%3C%2Fh2%3E%0A%0A%3Cp%3EAs+mentioned+above%2C+before+using+a+script+to+download+files+you+%0Ashould+always+%3Ca+target%3D%22_blank%22+href%3D%22%2Fphp%2Fparse-robots%2F%22%3Echeck+the+robots.txt+%0Afile%3C%2Fa%3E.++Here+we%27re+making+use+of+the+%3Ctt%3Erobots_allowed%3C%2Ftt%3E+function+%0Afrom+the+article+linked+above+to+determine+whether+we%27re+allowed+to+%0Aaccess+files%3A%3C%2Fp%3E%0A%0A%3Cp%3EAs+mentioned+above%2C+before+using+a+script+to+download+files+you+%0Ashould+always+%3Ca+href%3D%22%2Fphp%2Fparse-robots%2F%22%3Echeck+the+robots.txt+%0Afile%3C%2Fa%3E.++Here+we%27re+making+use+of+the+%3Ctt%3Erobots_allowed%3C%2Ftt%3E+function+%0Afrom+the+article+linked+above+to+determine+whether+we%27re+allowed+to+%0Aaccess+files%3A%3C%2Fp%3E'
   28     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        SEND_REF                                                 !2
          6        SEND_VAL                                                 258
          7        DO_ICALL                                                 
   30     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !2
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.36 ms | 1395 KiB | 17 Q