Re: Variable name for constants?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 hope so..

Anders.

I dont think you can do that with a constant, but you can do this a normal variable:

$test = 'the value of test variable';
$var ='test';

echo $$var;
// will echo $test;

Clive



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux