note 11766 modified in define by jmcastagnetto
| From: | jmcastagnetto@php.net | Date: | Tue, 06 Mar 2001 19:11:41 +0000 |
| Subject: | note 11766 modified in define by jmcastagnetto | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-11952@lists.php.net to get a copy of this message | ||
[Editor's note: see the (still undocumented) constant() function, from the source code:
mixed constant(string const_name)
Given the name of a constant this function will return the constants associated value
It will be properly documented soon]
I am also looking for a way to use constant whose name is stored in another variable, like:
define("MYCONST_1","something");
define("MYCONST_2","something_else");
for ($loop = 1; $loop < 3; $loop++) {
${"my_other_var_".$loop} = "MYCONST_".$loop;
}
A quick and not-so-pretty way of doing this is just to change constants to regular variables, but
this kinda defeats their original purpose, so a solution would be handy here.
http://www.php.net/manual/define.php