3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<EOT <html> Some html <a class="title" href="showthread.php?t=XXXXX" id="thread_title_5">DATADATA</a> More html <a class="title" href="showthread.php?t=987654" id="thread_title_1234">inner text</a> </html> EOT; $dom = new DOMDocument; $dom->loadHTML($html); $xpath = new DOMXPath($dom); foreach ($xpath->query('//a[starts-with(@href, "showthread.php")]') as $node) { parse_str(parse_url($node->getAttribute('href'), PHP_URL_QUERY), $queryString); printf( "t: %s\ntitle: %s\ninnerHTML: %s\n---\n", $queryString['t'] ?? 'no query string', filter_var($node->getAttribute('id'), FILTER_SANITIZE_NUMBER_INT), $node->nodeValue ); }
Output for git.master, git.master_jit, rfc.property-hooks
t: XXXXX title: 5 innerHTML: DATADATA --- t: 987654 title: 1234 innerHTML: inner text ---

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
51.64 ms | 1505 KiB | 4 Q