note 17466 modified in language.variables.scope by danbrown
| From: | danbrown@php.net | Date: | Mon, 18 May 2009 01:44:53 +0000 |
| Subject: | note 17466 modified in language.variables.scope by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155591@lists.php.net to get a copy of this message | ||
When defining static variables you may use such declarations:
<?php
static $var = 1; //numbers
static $var = 'strings';
static $var = array(1,'a',3); //array construct
?>
but these ones would produce errors:
<?php
static $var = some_function('arg');
static $var = (some_function('arg'));
static $var = 2+3; //any expression
static $var = new object;
?>
--was--
When defining static variables you may use such declarations:
static $var = 1; //numbers
static $var = 'strings';
static $var = array(1,'a',3); //array construct
but these ones would produce errors:
static $var = some_function('arg');
static $var = (some_function('arg'));
static $var = 2+3; //any expression
static $var = new object;
http://php.net/manual/en/language.variables.scope.php