I am using PHP Simple HTML DOM Parser * [Manual] to fetch data from websites.
Now what i wanna do is to remove first three words from all span which has class="yeah"
from the fetched content
So i have implement this code but it has a problem:
foreach($html->find('span.yeah') as $xdat)
{
$x_des = implode(' ', array_slice(explode(' ', strip_tags($xdat)), 0, 3));
$result = str_replace($x_des, ' ', $result);
$result = str_get_html($result);
}
Though it delete first three words from all <span class="yeah">
but the problem is, this modify full fetched content. But i wanna modify only those data whose are in <span class="yeah">
but it match first three words from all fetched data and then delete all of them, though i wanna remove those data from only those span types.
So, how to remove only first three words from all <span class="yeah"> </span>
in the fetched content?