Re: Re: class const versus define

From: Date: Wed, 24 Sep 2008 16:13:48 +0000
Subject: Re: Re: class const versus define
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-280850@lists.php.net to get a copy of this message
On Wed, Sep 24, 2008 at 7:35 AM, Richard Lynch <rlynch@peak6.com> wrote: > I need the PATH to differ in development, staging, and production due to > mixed environments. factory *cough* > Unfortunately, I CANNOT construct a class const "on the fly" from global > define'd constants and constant strings. no, but you could select a class on the fly from globally defined constants. So, in fact, I'd LIKE to use the class const properly for what it is mean > for, but cannot do that because its value depends upon the environment. i tend to agree w/ Jocheem here, if the value is something that will vary, perhaps it is best implemented as an instance variable rather than a constant. a factory method which took $path, or $env (something like that) could easily select an appropriate concrete class to instantiate. -nathan

« previous php.general (#280850) next »