note 74516 rejected from language.variables.scope by colder
| From: | colder@php.net | Date: | Sun, 15 Apr 2007 14:36:04 +0000 |
| Subject: | note 74516 rejected from language.variables.scope by colder | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125419@lists.php.net to get a copy of this message | ||
Note Submitter:
----
There's a problem with example 12.6.
Each time the function is called, $a is set to zero, so it will always output zero, even though $a
is static!
<?php
function Test()
{
static $a = 0;
echo $a;
$a++;
}
?>