[nycphp-talk] Passing a variable to a constant
Carlos A Hoyos
cahoyos at us.ibm.com
Mon Jul 17 16:32:10 EDT 2006
> I'd like to pass a variable to a constant, like so:
>
> $imageDir='/uploads/'.$orgID.'/images/';
> define('IMAGE_PATH_DIRECTORY', $imageDir)
>
> It doesn't seem to be working. Every time I check the value, the
> $orgID is missing. I can print it to the screen (it's held in the
There shouldn't be any problem in defining a constant through a variable.
What is not allowed, and will be ignored, is to redefine or change a
constant.
If the constant IMAGE_PATH_DIRECTORY, had previously been defined, your
code will be ignored.
Carlos Hoyos
More information about the talk
mailing list