<?php
I use PHP 4.3 and it's impossible to assign a variable or
function result to a static variable :-( Example:
function SomeFunction()
{
$LocalVar = 5;
static $MyStaticVar1 = some_function(); //ERROR
static $MyStaticVar2 = $LocalVar //ERROR
static $MyStaticVar3 = 7; //OK
return $MyStaticVar3++;
}
It's a little annoying, because in some cases the value of
static variables aren't necessarily known at the moment of
their initialisation. And sometimes it's required to be a
value returned by some function or a value of some other
function created earlier. Unfortunately, the moment of the
initialization is the only moment, when this kind of
assignment is possible to execute only on the first time the
function is called.
?>
----
Server IP: 195.136.184.34
Probable Submitter: 83.30.213.218
----
X-Spam-Status: No, hits=3.1 required=5.0
tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/language.variables.scope.p
hp
Edit -- http://master.p
hp.net/note/edit/63820
Del: integrated -- ht
tp://master.php.net/note/delete/63820/integrated
Del: useless -- http:
//master.php.net/note/delete/63820/useless
Del: bad code -- http
://master.php.net/note/delete/63820/bad+code
Del: spam -- http://m
aster.php.net/note/delete/63820/spam
Del: non-english -- h
ttp://master.php.net/note/delete/63820/non-english
Del: in docs -- http:
//master.php.net/note/delete/63820/in+docs
Del: other reasons-- http://master
.php.net/note/delete/63820
Reject -- http://master
.php.net/note/reject/63820
Search -- http://ma
ster.php.net/manage/user-notes.php
--
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php
|