Hello everyone.
I am trying to count the different elements in an xml sheet using SIMPLE XML with no luck
function findTotal()
{
$count=0; //variable holding the
foreach($xml->weddings as $item)
{
$count+=1;
}
echo 'this is the last item: ' . $count;
}
am i doing something wrong? how do i count the iterations of the foreach loop and assign it to variable count correctly?
foreach loop Counter Not working...?
Moderator: General Moderators
-
imsoconfused
- Forum Newbie
- Posts: 15
- Joined: Mon Oct 05, 2009 10:55 pm
Re: foreach loop Counter Not working...?
You can just use count for this.