Re: string operators for assigning class constants

From: Date: Wed, 20 Feb 2008 23:58:39 +0000
Subject: Re: string operators for assigning class constants
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-269757@lists.php.net to get a copy of this message
this is a php generals type of question. Sebastian schreef:
hi, why isn't it possible to assign class constants like this: class test {
           const DIR='dirname'.DIRECTORY_SEPARATOR.'anotherdirname'.DIRECTORY_SEPARATOR;
} is there some performance issue?
classes are defined at compile time, so are their const declarations - it's not possible to evaluate an expression at compile time. with define('FOO', 'bar'.QUX); you can do it because the define occurs at run time.
anyone ever tried this or was there a discussion about it? i would find this very useful.....
find another way to do 'it' :-)
greetings


« previous php.general (#269757) next »