Dynamic constant names -SOLVED
| From: | Geoff Caplan | Date: | Wed, 28 Mar 2001 00:14:56 +0000 |
| Subject: | Dynamic constant names -SOLVED | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-45798@lists.php.net to get a copy of this message | ||
Art,
Thanks for the suggestion, but I think there is a flaw in your
solution.
The original issue was how to get at the value of a constant where the
$constant_name is dynamically created as a variable.
In your solution you have defined constant_name as a constant!
So when you assign it, it does, of course, behave as a constant.
I don't think the ${...} notation is doing anything - it is just being
ignored by the parser so far as I can see ...
AW> $test_name="ta_dah";
AW> define("constant_name","test_name");
AW> $constant_value=${constant_name};
Geoff Caplan