note 30020 added to language.variables.scope
| From: | php-general at lists dot php dot net | Date: | Tue, 04 Mar 2003 13:25:40 +0000 |
| Subject: | note 30020 added to language.variables.scope | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-44825@lists.php.net to get a copy of this message | ||
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.
--
http://www.php.net/manual/en/language.variables.scope.php
http://master.php.net/manage/user-notes.php?action=edit+30020
http://master.php.net/manage/user-notes.php?action=delete+30020
http://master.php.net/manage/user-notes.php?action=reject+30020