If you absolutely have to do this,
define ("HELLO", "hello-you");
$var_{HELLO} = "something";
echo $var_{HELLO};
Question
please can you help me in this problem?
If in PHP I have a defined constant, can I use that constant name within a variable name?
For example how can I do something like the following in valid php syntax?
define ("HELLO", "hello-you");
$var_HELLO = "something";
echo $var_HELLO;
where HELLO in the variable name is the defined constant.
many thanks.
Solution
If you absolutely have to do this,
define ("HELLO", "hello-you");
$var_{HELLO} = "something";
echo $var_{HELLO};