From 5ee8366690d368337e8d8aed0560e2d7c44b28c1 Mon Sep 17 00:00:00 2001 From: Etienne Kneuss Date: Wed, 15 Aug 2007 15:41:29 +0000 Subject: [PATCH] Reverse dynamic static calls related DOC git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@241268 c90b9560-bf6c-de11-be94-00142212c4b1 --- language/oop5/constants.xml | 17 ++++++----------- language/oop5/paamayim-nekudotayim.xml | 12 +----------- language/oop5/static.xml | 12 +----------- 3 files changed, 8 insertions(+), 33 deletions(-) diff --git a/language/oop5/constants.xml b/language/oop5/constants.xml index c7bcfda07a..1828a61d2d 100644 --- a/language/oop5/constants.xml +++ b/language/oop5/constants.xml @@ -1,21 +1,20 @@ - + Class Constants It is possible to define constant values on a per-class basis remaining the same and unchangeable. Constants differ from normal variables in that you - don't use the $ symbol to declare or use them. + don't use the $ symbol to declare or use them. Like + static members, constant values + cannot be accessed from an instance of the object (using + $object::constant). The value must be a constant expression, not (for example) a variable, a class member, result of a mathematical operation or a function call. - - As of PHP 5.2.4, it's possible to reference the class using a variable. - - Defining and using a constant @@ -32,13 +31,9 @@ class MyClass echo MyClass::constant . "\n"; -$classname = "MyClass"; -echo $classname::constant . "\n"; - $class = new MyClass(); $class->showConstant(); - -echo $class::constant."\n"; +// echo $class::constant; is not allowed ?> ]]> diff --git a/language/oop5/paamayim-nekudotayim.xml b/language/oop5/paamayim-nekudotayim.xml index 22593da4a5..422b557e0d 100644 --- a/language/oop5/paamayim-nekudotayim.xml +++ b/language/oop5/paamayim-nekudotayim.xml @@ -1,5 +1,5 @@ - + Scope Resolution Operator (::) @@ -16,10 +16,6 @@ the name of the class. - - As of PHP 5.2.4, it's possible to reference the class using a variable. - - Paamayim Nekudotayim would, at first, seem like a strange choice for naming a double-colon. However, while writing the Zend Engine 0.5 @@ -36,9 +32,6 @@ class MyClass { const CONST_VALUE = 'A constant value'; } -$classname = 'MyClass'; -echo $classname::CONST_VALUE; - echo MyClass::CONST_VALUE; ?> ]]> @@ -65,9 +58,6 @@ class OtherClass extends MyClass } } -$classname = 'OtherClass'; -echo $classname::doubleColon(); - OtherClass::doubleColon(); ?> ]]> diff --git a/language/oop5/static.xml b/language/oop5/static.xml index d58e50b465..d0a47ead47 100644 --- a/language/oop5/static.xml +++ b/language/oop5/static.xml @@ -1,5 +1,5 @@ - + Static Keyword @@ -32,10 +32,6 @@ Calling non-static methods statically generates an E_STRICT level warning. - - As of PHP 5.2.4, it's possible to reference the class using a variable. - - Static member example @@ -69,9 +65,6 @@ print $foo->my_static . "\n"; // Undefined "Property" my_static print Bar::$my_static . "\n"; $bar = new Bar(); print $bar->fooStatic() . "\n"; - -$classname = "Bar"; -print $classname::$my_static; ?> ]]> @@ -89,9 +82,6 @@ class Foo { } Foo::aStaticMethod(); - -$classname = "Foo"; -print $classname::aStaticMethod(); ?> ]]>