note 17556 added to function.get-defined-constants

From: Date: Thu, 13 Dec 2001 22:03:48 +0000
Subject: note 17556 added to function.get-defined-constants
Groups: php.notes 
Request: Send a blank email to php-notes+get-22599@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. -- http://www.php.net/manual/en/function.get-defined-constants.php http://master.php.net/manage/user-notes.php?action=edit+17556 http://master.php.net/manage/user-notes.php?action=delete+17556 http://master.php.net/manage/user-notes.php?action=reject+17556

« previous php.notes (#22599) next »