NYCPHP Meetup

NYPHP.org

[nycphp-talk] Passing a variable to a constant

Donald J Organ IV dorgan at optonline.net
Mon Jul 17 15:54:31 EDT 2006


Why use a constant in that case, why not refer to the variable.

Constants are meant not to be changed.

Randal Rust wrote:
> 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
> $_SESSION), so I know it's there. My guess is that I just can't do
> this, and I'm not finding anything via Google or php.net that tells me
> otherwise.
>
>   



More information about the talk mailing list