colder          Tue Jul 18 11:19:52 2006 UTC

  Modified files:              
    /phpdoc/en/language/oop5    basic.xml 
  Log:
  Fix #37880 (members' default value)
  
http://cvs.php.net/viewvc.cgi/phpdoc/en/language/oop5/basic.xml?r1=1.16&r2=1.17&diff_format=u
Index: phpdoc/en/language/oop5/basic.xml
diff -u phpdoc/en/language/oop5/basic.xml:1.16 
phpdoc/en/language/oop5/basic.xml:1.17
--- phpdoc/en/language/oop5/basic.xml:1.16      Mon May  1 14:30:50 2006
+++ phpdoc/en/language/oop5/basic.xml   Tue Jul 18 11:19:52 2006
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.16 $ -->
+<!-- $Revision: 1.17 $ -->
 
  <sect1 id="language.oop5.basic">
   <title>The Basics</title>
@@ -84,6 +84,37 @@
     </programlisting>
    </example>
 
+   <para>
+    The default value must be a constant expression, not (for example) a
+    variable, a class member or a function call.
+    <example>
+     <title>Class members' default value</title>
+     <programlisting role="php">
+<![CDATA[
+<?php
+class SimpleClass
+{
+    // invalid member declarations:
+    public $var1 = 'hello '.'world';
+    public $var2 = <<<EOD
+hello world
+EOD;
+    public $var3 = 1+2;
+    public $var4 = self::myStaticMethod();
+    public $var5 = $myVar;
+
+    // valid member declarations:
+    public $var6 = myConstant;
+    public $var7 = self::classConstant;
+    public $var8 = array(true, false);
+    
+    
+}
+?>
+]]>
+     </programlisting>   
+    </example>
+   </para>
    <note>
     <para>
     There are some nice functions to handle classes and objects. You might want

Reply via email to