Reputation: 4518
Suppose I have some html and I want to parse something from it. In my html I know A, and want to know what is in C . I start getting all td elements, but what to do next ?
I need to check something like " if this td has A as value then check what is written in third td after this. But how can I write it ?
$some_code = ('
....
<tr><td>A</td><td>...</td><td>c</td></tr>
.....
');
$doc->loadHTML($some_code);
$just_td = $doc->getElementsByTagName('td');
foreach ($just_td as $t) {
some code....
}
Upvotes: 2
Views: 376