note 63918 added to language.variables.scope
| From: | Rhett at osu1 dot php dot net | Date: | Mon, 03 Apr 2006 20:37:29 +0000 |
| Subject: | note 63918 added to language.variables.scope | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-107251@lists.php.net to get a copy of this message | ||
You could get around that:
<?php
function someFunction () {
static $isInitialized = 0;
static $otherStatic = 0; // or whatever default you want
if (!$isInitialized) {
$otherStatic = function(); // or whatever
$isInitialized = 1;
}
...
}
?>
Needs an extra variable and evaluates a condition every time it's run, but it does get around
your problem.
----
Server IP: 216.194.113.175
Probable Submitter: 71.70.235.198
----
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.php
Edit -- http://master.php.net/note/edit/63918
Del: integrated -- http://master.php.net/note/delete/63918/integrated
Del: useless -- http://master.php.net/note/delete/63918/useless
Del: bad code -- http://master.php.net/note/delete/63918/bad+code
Del: spam -- http://master.php.net/note/delete/63918/spam
Del: non-english -- http://master.php.net/note/delete/63918/non-english
Del: in docs -- http://master.php.net/note/delete/63918/in+docs
Del: other reasons-- http://master.php.net/note/delete/63918
Reject -- http://master.php.net/note/reject/63918
Search -- http://master.php.net/manage/user-notes.php