note 19069 added to function.unset
| From: | php-general at lists dot php dot net | Date: | Thu, 14 Feb 2002 18:11:19 +0000 |
| Subject: | note 19069 added to function.unset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-26618@lists.php.net to get a copy of this message | ||
beware that the behavior of unset on static variables have changed. With php 4.1.1 the above example
actually output 1 2 3.
the static variable is unset after the call to unset but php "forgets" it has unsetted the
variable on the next call to foo :
function foo(){
static $a;
$a++;
echo "$a\n";
unset $a;
echo "$a\n";
}
foo();
foo();
foo();
will output
1
2
3
Ivan
--
http://www.php.net/manual/en/function.unset.php
http://master.php.net/manage/user-notes.php?action=edit+19069
http://master.php.net/manage/user-notes.php?action=delete+19069
http://master.php.net/manage/user-notes.php?action=reject+19069