Posted by Marcus Bointon on 10/21/65 11:22
I'm not sure if this is a bug or a feature, but it seems you can't
use class constants to set default values for class properties. You
can, however, use them for default values for method params, e.g.:
class foo {}
const BAR = 100;
private $thing = self::BAR;
function wibble($a = self::BAR) {
echo $a;
}
}
In this case $this->thing will be undefined, but wibble() will get
the correct default value for $a.
Comments?
Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
marcus@synchromedia.co.uk | http://www.synchromedia.co.uk
[Back to original message]
|