note 30020 deleted from language.variables.scope by danbrown
| From: | danbrown@php.net | Date: | Mon, 18 May 2009 01:41:33 +0000 |
| Subject: | note 30020 deleted from language.variables.scope by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155578@lists.php.net to get a copy of this message | ||
Note Submitter:
----
As far as I can see, it's not possible to unset() a static variable inside the function:
function Test($unset = false) {
static $a = 0;
echo $a++;
if ($unset) unset($a);
}
Test();
Test();
Test(true);
Test();
Test();
This will output 01234. I would expect it to at least show 01201.