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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php