note 93318 rejected from language.oop5.paamayim-nekudotayim by danbrown
| From: | danbrown@php.net | Date: | Wed, 02 Sep 2009 21:36:21 +0000 |
| Subject: | note 93318 rejected from language.oop5.paamayim-nekudotayim by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160180@lists.php.net to get a copy of this message | ||
Note Submitter: sgrantham at walled dot net
----
The use here is completely inconsistent with the -> operator The -> operator takes a class
instance object to the left and the class property or method to the right (without the dollar sign).
It can also take a string variable to the right and will evaluate it to the property or method
name.
The scope resolution operator on the other hand takes an explicit class name to the left or a
variable containing a string of the class name (php 5.3) and a variable to the right (with $ sign)
that is not really a variable but is the name of the property, unless of course a method is being
referenced in which case it has the explicit function name.
I think a much better definition would have been:
MyClass::myProperty // explicit reference to static property
MyClass::myMethod() // explicit reference to static method
$myInstance->MyParentClass::myProperty // Super class reference
$myClassString::$myPropertyString // variable reference to class by string variable name and static
property by string variable name
$myClassString::$myMethodString() // variable reference to class by string variable name and static
method by string variable name
$myInstance->$MyParentClass::$myProperty // totally variable