note 21394 deleted from language.variables.scope by didou
| From: | didou@php.net | Date: | Fri, 03 Oct 2003 11:34:25 +0000 |
| Subject: | note 21394 deleted from language.variables.scope by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57708@lists.php.net to get a copy of this message | ||
Note Submitter: tbm_at_home_dot_com
----
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.