Use getAttribute()
:
for ($i = 9; $i > 0; $i--){
$table = $tables->item($i);
if ($table->getAttribute('class') == 'name_con') {
echo "<tr><td>".$table->nodeValue."</td></tr>\n";
}
}
This is also possible with an XPath expression:
$xpath = new DOMXPath($dom);
$nodes = $xpath->query('//td[contains(@class,"name_con")]');
echo "<table>";
foreach ($nodes as $node) {
echo "<tr><td>".$node->nodeValue."</td></tr>\n";
}
echo "</table>";