Why do constants behave like this??
| From: | Geoff Caplan | Date: | Tue, 19 Jun 2001 22:54:05 +0000 |
| Subject: | Why do constants behave like this?? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-54478@lists.php.net to get a copy of this message | ||
Hi folks
I define a constant in a config file:
define( 'VARIABLE_CLASS', 'myclass' ) ;
Can any kind person explain why this fails with the error "Cannot
instantiate non-existent class"
>>>>>>>>>>>>>>
new VARIABLE_CLASS ;
>>>>>>>>>>>>>>
While this works:
>>>>>>>>>>>>>>
$class = VARIABLE_CLASS ;
new $class ;
>>>>>>>>>>>>>>
Must be something about constants which I don't understand...
Thanks
Geoff Caplan