> > 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, but I don't get it.. ;-)
Say I have these definitions;
define("IMG_HOME", "pic1.png");
define("IMG_AWAY", "pic2.png");
define("IMG_ELSE", "pic3.png");
Then a function should present the right image based on a variable
(pseudocode):
function show($name) {
present_img( IMG_$name );
}
If I understand right (probably not...), then I could concat and do like
this?
present_img( constant("IMG_" . $name) );
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php