PHP 4.0 Bug #8863: function to get constant values by variable name
| From: | andrew at andrew dot org | Date: | Tue, 23 Jan 2001 17:21:28 +0000 |
| Subject: | PHP 4.0 Bug #8863: function to get constant values by variable name | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-44833@lists.php.net to get a copy of this message | ||
From: andrew@andrew.org
Operating system: Any
PHP version: 4.0.4pl1
PHP Bug Type: Feature/Change Request
Bug description: function to get constant values by variable name
I believe PHP lacks a function to get constant values by
name where the constant's name is stored in a string variable.
What I mean is something like
function get_constant($const_name)
{
eval ("\$myvar = " . $const_name . ";");
return $myvar;
}
but I really think that using eval() here is a waste.
Am I missing something?
andrew
--
Edit Bug report at: http://bugs.php.net/?id=8863&edit=1