note 21394 added to language.variables.scope
| From: | tbm_at_home_dot_com@php.net | Date: | Sat, 11 May 2002 04:07:15 +0000 |
| Subject: | note 21394 added to language.variables.scope | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-30454@lists.php.net to get a copy of this message | ||
You can't create static variables if you assign to them the value of another variable
(including the return value of a function).
The following code would generate a parse error (at least on my system running PHP 4.1.2):
function foobar() {
$foo = 0;
static $bar = $foo; /* parse error... */
/* the same with return values of functions */
static $blah = whatever(); /* yup, parse error */
}
Quite a pity, isn't it.
--
http://www.php.net/manual/en/language.variables.scope.php
http://master.php.net/manage/user-notes.php?action=edit+21394
http://master.php.net/manage/user-notes.php?action=delete+21394
http://master.php.net/manage/user-notes.php?action=reject+21394