Hi,
I have read the manual entry on static scope, and I still don't really get it. I understand the basic idea, which is that it allows variable to persist once the function has finished running. But, well. The PHP manual's example is this:
Code:
<?php
function test()
{
static $a = 0;
echo $a;
$a++;
}
?>
I don't understand why it only sets $a to 0 once. Isn't the variable still static when it is being added to? I guess, static variable declarations are only done once, and operations, since they cannot be static, are performed as many times as the function runs ... but I still don't really get it. For example, how does PHP know how many times the function has run? Also, well, I guess I was just looking for an explanation of scope in different words to make it a bit more clear.
Thanks in advance,
JaneDean