3v4l.org

run code in 500+ PHP versions simultaneously
<?php $content = <<<CONTENT <span class="ipsHide" data-role="downloadCounterContainer">Download begins in <span data-role="downloadCounter"></span> seconds</span> <a href='https://example.com/forum/files/file/2-content/?do=download&amp;r=24050&amp;confirm=1&amp;t=1&amp;csrfKey=72c4d0ffcabb34c6d6c490cbacbc354ag1536355261' class='ipsButton ipsButton_primary ipsButton_small' data-action="download" >Download</a> CONTENT; $doc = new DOMDocument(); $doc->loadHTML($content); $xpath = new DomXPath($doc); $results = $xpath->query("//a[contains(@class, 'ipsButton') and contains(@class, 'ipsButton_primary') and contains(@class, 'ipsButton_small')]"); foreach ($results as $result) { $url = parse_url($result->getAttribute("href"), PHP_URL_QUERY); parse_str($url, $params); echo $params['csrfKey']; }
Output for 5.6.38 - 5.6.40, 7.0.33, 7.1.0 - 7.1.30, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
72c4d0ffcabb34c6d6c490cbacbc354ag1536355261

preferences:
114.25 ms | 1572 KiB | 4 Q