3v4l.org

run code in 300+ PHP versions simultaneously
<?php header('Content-Type: text/plain; charset=utf-8'); $body = file_get_contents('http://chat.stackoverflow.com/search?q=tag%3Acv-pls%20tag%3Adelv-pls&Room=11&page=1&pagesize=50&sort=newest'); $qids = []; libxml_use_internal_errors(true); $doc = new DOMDocument; $doc->loadHTML($body); $xpath = new DOMXpath($doc); $nodes = $xpath->query("//a[contains(@href, 'tagged')]/following-sibling::a[not(contains(@href, 'tagged')) and not(contains(@href, '#'))]"); foreach ($nodes as $node) { /** @var $node DOMElement */ if (preg_match('#(?:q|questions)/(?P<qid>\d+)#', $node->getAttribute('href'), $matches)) { $qids[] = $matches['qid']; } } print_r($qids);

preferences:
41.79 ms | 402 KiB | 5 Q