tired of referencing static variables/constants with 'self ::'

From: Date: Tue, 09 May 2006 17:42:49 +0000
Subject: tired of referencing static variables/constants with 'self ::'
Groups: php.general 
Request: Send a blank email to php-general+get-235808@lists.php.net to get a copy of this message
Does anyone know if it's possible to reference class constants or static variables without having to use 'self::' all the time? class A { const MY_CONSTANT = true; public function test() {
      echo self :: MY_CONSTANT; // works
      echo MY_CONSTANT; // doesn't work
} } I don't think it is possible, but why not? Can zend/php make it work? Seems it could since this works: define('MY_CONSTANT', true); class A { public function test() {
      echo MY_CONSTANT; // works
} } It's just annoying my how much boiler-plate I have to write all the time. Dante

« previous php.general (#235808) next »