accessing a constant which name is stored in a variable

From: Date: Sun, 03 Sep 2000 21:00:09 +0000
Subject: accessing a constant which name is stored in a variable
Groups: php.dev 
Request: Send a blank email to php-dev+get-31848@lists.php.net to get a copy of this message
Would it make sense to add the ability to access constants through a function or syntax where the constant name is stored in a variable? I tried a few methods, but I think it isn´t possible: define('my_constant',TRUE); $c_name='my_constant'; echo $$my_constant; // sure, does not work echo {$my_constant}; // does not work either well, then I had in mind to add a statement/function that returns the value of a constant as follows: (mixed) get_constant( (string) constant_name ) I hope I did not miss a very simple way... andré

« previous php.dev (#31848) next »