In PHP you can create variable variables. Is there any way to do something similar with constants?
I'm using some variable variables like this:
$a = 'cat';
$b = 'a';
$c = $$b; (which is the same as $c = 'cat'
I want to do the same type of thing with a constant, where I've got the name of the constant as a string attached to a variable, and then want to use that variable to call the constant.
Any way to do this?
I'm using some variable variables like this:
$a = 'cat';
$b = 'a';
$c = $$b; (which is the same as $c = 'cat'
I want to do the same type of thing with a constant, where I've got the name of the constant as a string attached to a variable, and then want to use that variable to call the constant.
Any way to do this?
