note 10843 rejected and deleted from define by danbeck
| From: | danbeck@php.net | Date: | Thu, 08 Mar 2001 18:02:18 +0000 |
| Subject: | note 10843 rejected and deleted from define by danbeck | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-12046@lists.php.net to get a copy of this message | ||
how can I get the value of a constant whose name is stored into a string variable?
the only way I found is not very elegant, that is
// $constant_name = "CONSTANT";
eval("$myvar = " . $constant_name . ";");
I think PHP lacks some ad hoc function here, something like ini_get() for php.ini values. Or at
least I have not found any function doing this.
andrew