mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
Document that static properties may not be initialized to expressions.
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@268329 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
476b6b1b1b
commit
1b92251272
1 changed files with 9 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision: 1.17 $ -->
|
||||
<!-- $Revision: 1.18 $ -->
|
||||
<sect1 xml:id="language.oop5.static" xmlns="http://docbook.org/ns/docbook">
|
||||
<title>Static Keyword</title>
|
||||
|
||||
|
@ -32,6 +32,14 @@
|
|||
Calling non-static methods statically generates an E_STRICT level warning.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Like any other PHP static variable, static properties must be
|
||||
initialized using a literal or constant; expressions are not
|
||||
allowed. So while you may initialize a static property to an
|
||||
integer or array (for instance), you may not initialize it to
|
||||
another variable, to a function return value, or to an object.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
As of PHP 5.3.0, it's possible to reference the class using a variable.
|
||||
The variable's value can not be a keyword (e.g. <literal>self</literal>,
|
||||
|
|
Loading…
Reference in a new issue