[PHP] Variable name for constants?

2008-12-11 Thread Anders Norrbring
I've been experimenting with having a varaible constant name, but failed miserably... Can I please have a pointer? What I'm trying to do is something like this: $name = home; Then read the constant IMG_HOME, like IMG_$name, I'm not sure I make myself understood, but I hope so.. Anders. --

Re: [PHP] Variable name for constants?

2008-12-11 Thread clive
Anders Norrbring wrote: I've been experimenting with having a varaible constant name, but failed miserably... Can I please have a pointer? What I'm trying to do is something like this: $name = home; Then read the constant IMG_HOME, like IMG_$name, I'm not sure I make myself understood, but I

Re: [PHP] Variable name for constants?

2008-12-11 Thread clive
I dont think you can do that with a constant, but you can do this a normal variable: I stand under correction form my previous email, it can be done: define('TEST', 'the value of constant TEST'); $var= 'TEST'; echo constant($var); -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] Variable name for constants?

2008-12-11 Thread HostWare Kft.
, 2008 9:18 AM Subject: Re: [PHP] Variable name for constants? I dont think you can do that with a constant, but you can do this a normal variable: I stand under correction form my previous email, it can be done: define('TEST', 'the value of constant TEST'); $var= 'TEST'; echo constant

SV: [PHP] Variable name for constants?

2008-12-11 Thread Anders Norrbring
I dont think you can do that with a constant, but you can do this a normal variable: I stand under correction form my previous email, it can be done: define('TEST', 'the value of constant TEST'); $var= 'TEST'; echo constant($var); This may be too early in the morning for me,

SV: [PHP] Variable name for constants?

2008-12-11 Thread Anders Norrbring
, December 11, 2008 9:18 AM Subject: Re: [PHP] Variable name for constants? I dont think you can do that with a constant, but you can do this a normal variable: I stand under correction form my previous email, it can be done: define('TEST', 'the value of constant TEST'); $var