Bug #8863 Updated: function to get constant values by variable name
| From: | jan@php.net | Date: | Sun, 06 Jan 2002 18:00:48 +0000 |
| Subject: | Bug #8863 Updated: function to get constant values by variable name | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-76071@lists.php.net to get a copy of this message | ||
ID: 8863
Updated by: jan
Reported By: andrew@andrew.org
Old Status: Open
Status: Closed
Bug Type: Feature/Change Request
Operating System: Any
PHP Version: 4.0.4pl1
New Comment:
and close it
Previous Comments:
------------------------------------------------------------------------
[2002-01-06 13:00:36] jan@php.net
see get_defined_constants
------------------------------------------------------------------------
[2001-01-23 12:21:28] andrew@andrew.org
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 this bug report at http://bugs.php.net/?id=8863&edit=1