cvs: phpdoc /en/language oop.xml

From: Date: Fri, 09 Feb 2001 19:41:09 +0000
Subject: cvs: phpdoc /en/language oop.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969334263@lists.php.net to get a copy of this message
cnewbill Fri Feb 9 11:41:09 2001 EDT Modified files: /phpdoc/en/language oop.xml Log: Added the following lines: Both in and outside of the object you do not need a $ when accessing an object's properties. Also a code snippet to reference the previous statement. Index: phpdoc/en/language/oop.xml diff -u phpdoc/en/language/oop.xml:1.5 phpdoc/en/language/oop.xml:1.6 --- phpdoc/en/language/oop.xml:1.5 Mon Oct 2 02:37:53 2000 +++ phpdoc/en/language/oop.xml Fri Feb 9 11:41:08 2001 @@ -99,8 +99,24 @@ <para> Within functions of a class the variable $this means this object. You have to use $this->something to access any variable or - function named something within your current object. + function named something within your current object. Both in and + outside of the object you do not need a $ when accessing an object's + properties. </para> + + <informalexample> + <programlisting role="php"> +$ncart->owner = "chris"; // no $ + +$ncart->$owner = "chris"; +// this is invalid because $ncart->$owner = $ncart->"" + +$myvar = 'owner'; +$ncart->$myvar = "chris"; +// this is valid because $ncart->$myvar = $ncart->owner + </programlisting> + </informalexample> + <para> Constructors are functions in a class that are automatically called when you create a new instance of a class. A function

« previous php.doc (#969334263) next »