- Output for 5.3.0 - 5.3.27, 5.4.0 - 5.4.21
- Parse error: syntax error, unexpected '?' in /in/N9EKn on line 22
Process exited with code 255.
<?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);