3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<EOF <div id="nav"> <ul id="someID"> <li><a href="/poker/?ca=v"> THIS </a></li> </ul> </div> EOF; function extractNodeValue($query, $xPath, $attribute = null) { $node = $xPath->query("//{$query}")->item(0); if (!$node) { return null; } return $attribute ? $node->getAttribute($attribute) : $node->nodeValue; } $document = new DOMDocument(); $document->loadHTML($html); $xPath = new DOMXpath($document); $name = extractNodeValue("//a[@href="/poker/?ca=v']/text()",$xPath);
Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.21
Parse error: syntax error, unexpected '?' in /in/lnCQ1 on line 22
Process exited with code 255.

preferences:
176.98 ms | 1395 KiB | 57 Q