note 121882 deleted from language.variables.scope by crell
| From: | crell@php.net | Date: | Thu, 31 Mar 2022 19:33:32 +0000 |
| Subject: | note 121882 deleted from language.variables.scope by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-217916@lists.php.net to get a copy of this message | ||
Note Submitter: Hayley Watson
----
static variables are implicitly initialised to NULL if no explicit initialisation is made.
<?php
function foo()
{
static $v;
echo gettype($v);
}
foo();
?>
will echo NULL without complaining that $v is undefined.
In short: "static $v;" is equivalent to "static $v = null;".