I am using this piece of code with using Simple Html dom :
$google = "http://www.google.com/something.";
$html = file_get_html($google_html);
foreach ($html->find('span[class=st]') as $element)
echo $element->innertext;
But i just want to echo out the first one of $element->innertext
.
How can i just echo out first one ?
The above code echo's all elements.
- Is there any way to stop the searching of simpledom , when the first child of array get found ?
I mean we don't need to get ALL of the elements, we just need the first one, so it's wasting time to picking all elements and them picking up the first one !
the Better is that when the fist one , got found , the SimpleDom get stop for finding new items.