How can I get this function to reset the variable $counter to 0 every time its called.
Currently the first time its called its fine, but the second time its called it produces no output, almost as if the $counter has remained on 5
function endElement($parser, $name) {
global $insideitem, $tag, $title, $description, $link,$counter;
static $counter = 0;
if ($name == "ITEM" && !(++$counter > 5))
{
if ($name == "ITEM")
{
echo"<a class=Text-Main-Headlines href=$link><span class=Text-Main-Headlines>$title</span></a><br>";
$title = "";
$description = "";
$link = "";
$date = "";
$insideitem = false;
}
}
}