Doc #54038 [NEW]: "static" scope resolution operator

From: Date: Thu, 17 Feb 2011 23:43:43 +0000
Subject: Doc #54038 [NEW]: "static" scope resolution operator
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-6005@lists.php.net to get a copy of this message
From: Operating system: PHP version: Irrelevant Package: Documentation problem Bug Type: Documentation Problem Bug description:"static" scope resolution operator Description: ------------ It's stated in http://php.net/manual/en/language.oop5.paamayim-nekudotayim.php that "Two special keywords _self_ and _parent_ are used to access properties or methods from inside the class definition", but there's also 3rd keyword which is not mentioned - "static". Test script: --------------- <?php header('content-type: text/plain'); class ParentClass { const property = 'parent'; public function getPropertySelf() { // use 'property' const of ParentClass return self::property; } public function getPropertyStatic() { // use 'property' const of called class return static::property; } } class ChildClass extends ParentClass { const property = 'child'; } $obj = new ChildClass(); var_dump($obj->getPropertySelf()); // string(6) "parent" var_dump($obj->getPropertyStatic()); // string(5) "child" -- Edit bug report at http://bugs.php.net/bug.php?id=54038&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54038&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54038&r=trysnapshot53 Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54038&r=trysnapshottrunk Fixed in SVN: http://bugs.php.net/fix.php?id=54038&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54038&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=54038&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=54038&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=54038&r=needscript Try newer version: http://bugs.php.net/fix.php?id=54038&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=54038&r=support Expected behavior: http://bugs.php.net/fix.php?id=54038&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=54038&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=54038&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=54038&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54038&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=54038&r=dst IIS Stability: http://bugs.php.net/fix.php?id=54038&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=54038&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=54038&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=54038&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=54038&r=mysqlcfg

« previous php.doc.bugs (#6005) next »