I am using the PHP Simple DOM Parser for parsing the HTML Page, Now i am lacking in particular point of how to find the nth element class should be a particular class
For Example:
<table>
<tr>
<th class="h1">ONE</td>
<th class="h2">TWO</td>
<th class="h3">THREE</td>
</tr>
<tr>
<td class="one">Apple</td>
<td class="two">Orange</td>
<td class="null">N/A</td>
</tr>
<tr>
<td class="one">Apple</td>
<td class="null">N/A</td>
<td class="three">Banana</td>
</tr>
</table>
The table looks something like this , so i am traversing the table via tr
foreach ($demo->find("tr") as $val)
{
if(is_object($val->find('td.null', 0))
{
echo "FOUND";
}
}
But the above foreach loop returns "FOUND" if td.null exist. But I need to find if 2nd element td class is null i need to return as TWO, If third td element class is null i need to return as Three
I hope so that you understand that what i am asking for , so please help me of how to find the nth element class is null