I am having trouble on adding a counter starting from 1 to the following piece of code, near echo $images;
I would like to count how many times it echoes $images. My purpose i to add the number next to images.
Any help would be great! Please have in mind if there is a way of making the following code better. Thank you!
foreach($items as $item) {
$descr = $xPath->query('./description', $item);
foreach ($descr as $d) {
$temp_dom = new DOMDocument();
$temp_dom->loadHTML( $d->nodeValue );
$temp_xpath = new DOMXPath($temp_dom);
$img = $temp_xpath->query('//div[@class="separator"]//img');
foreach ($img as $imgs) {
$images=$imgs->getAttribute('src');
echo $images; }
}
}