Thanks. I suspected that too, but according to my book (Learning PHP & MySQL by R'Oreilly) and some websites such as http://www.php.net/manual/en/language.variables.scope.php , http://webmaster-forums.code-head.com/showthread.php?t=202 , it seems that PHP only initializes static variables the first time this function is called, eg from one website is -
<?php
function test()
{
static $a = 0;
echo $a;
$a++;
}
?>
Anyway I've already tried but the variables defined outside of the function were not able to be referred to from inside the function.
This doesnt do what yer looking to do? Maybe I'm not understanding your question then
<?php
static $testvar = 1;
function vote () {
global $testvar;
echo $testvar;
if ($testvar == 1) {
$testvar++;
echo $testvar;
}
}
vote();
echo "<BR>";
vote();
?>