foreach loop Counter Not working...?
Posted: Mon Dec 14, 2009 5:52 pm
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?
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?