Dynamic constant names - SOLVED
| From: | Geoff Caplan | Date: | Tue, 27 Mar 2001 20:19:39 +0000 |
| Subject: | Dynamic constant names - SOLVED | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-45778@lists.php.net to get a copy of this message | ||
Hi folks
I mailed this to the list some time ago, but it seems to have got
"lost" so here is is again...
I had 2 suggestions from the list:
1) indirection - $constant_value = $$constant_name ;
I had already tried this, but couldn't get it to work. Unless I am
missing something it just gives an "Undefined Variable" error.
2) eval("\$constant_value = $constant_name;") ;
This does work. Thanks Paul and CC!
Geoff Caplan