Suppose i have a code like this:
<div class="container">
<span class="toshow">item1</span>
<span class="toshow">item2</span>
<span class="toshow">item3</span>
<span class="show">item4</span>
<span class="notshow">item4</span>
<span class="notshow">item5</span>
<span class="another">item5</span>
<span class="another">item5</span>
</div>
Now i just want to show the items having class "toshow" excluding the "notshow" items:
<?php
foreach($html->find('div[class="container"]') as $element)
echo $elemtnt->plaintext.'<br>';
?>
Also, i have tried this to exclude the span having class "notshow" :
<?php
foreach($html->find('div[class="container"] span[class! = "notshow"]') as $element)
echo $elemtnt->plaintext.'<br>';
?>
How to show all items using foreach loop? simple_html_dom.php