note 17556 deleted from function.get-defined-constants by jimw
| From: | jimw@php.net | Date: | Thu, 20 Dec 2001 23:57:34 +0000 |
| Subject: | note 17556 deleted from function.get-defined-constants by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23614@lists.php.net to get a copy of this message | ||
If you want a list of defined constants, here's a little workaround for pre PHP 4.0.7RC1 and
pre PHP 4.1 use ...
- Create a new global associative array named $def_list
- Create the following function
***********
function define_constant( $key_in, $val_in )
{
// Define the constant with the key name given and assigns the value given
$def_list[ $key_in ] = $val_in;
define( $key_in, $val_in );
} // end of function
**********
- Instead of using PHP's define function to define constants, do the following:
define_constant( "john", "doe" );
- After this call, the constant will be defined as expected, and it will also be stored in the
associative array $def_list as
Array ( [john] => doe )
Hope this helps.