I have this PHP code:
$document = new DOMDocument();
$document->loadHTML( $html );
$xpath = new DomXPath($document);
$tables = $xpath->query("//*[contains(@class, 'info')]");
$tableDom = new DomDocument();
$tableDom->appendChild($tableDom->importNode($tables->item(0), true));
How can I check if the $tables variable contains something that we can work with in the $tableDom?
I tried it with:
if (!empty($tables)) {
echo("</br>not empty</br>");
} else {
echo("empty");
}
if (!$tablese) {
echo("empty</br>");
}
However it always said its not empty, all trough the HTML doesn't contain a table with the class info.