cvs: phpdoc /en/language/oop5 static.xml
| From: | Torben Wilson | Date: | Wed, 05 Nov 2008 07:38:18 +0000 |
| Subject: | cvs: phpdoc /en/language/oop5 static.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-2389@lists.php.net to get a copy of this message | ||
torben Wed Nov 5 07:38:18 2008 UTC
Modified files:
/phpdoc/en/language/oop5 static.xml
Log:
Document that static properties may not be initialized to expressions.
http://cvs.php.net/viewvc.cgi/phpdoc/en/language/oop5/static.xml?r1=1.17&r2=1.18&diff_format=u
Index: phpdoc/en/language/oop5/static.xml
diff -u phpdoc/en/language/oop5/static.xml:1.17 phpdoc/en/language/oop5/static.xml:1.18
--- phpdoc/en/language/oop5/static.xml:1.17 Thu Feb 28 13:26:54 2008
+++ phpdoc/en/language/oop5/static.xml Wed Nov 5 07:38:18 2008
@@ -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>
@@ -33,6 +33,14 @@
</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>,
<literal>parent</literal> and <literal>static</literal>).