Dynamic constant names

From: Date: Tue, 27 Mar 2001 13:18:59 +0000
Subject: Dynamic constant names
Groups: php.general 
Request: Send a blank email to php-general+get-45721@lists.php.net to get a copy of this message
Hi folks I am trying to create a constant name dynamically and then get at the value. // We set up the constant define( CONSTANT_1 , "Some value" ) ; // Later we try to use it dynamically ... $constant_number = 1 ; $constant_name = ( "CONSTANT_" . $constant_number ) ; // We try to assign the constant value to a variable... $constant_value = $constant_name ; But we find that $constant value still contains the NAME of the constant, and not the VALUE. Am I misunderstanding something? Is there any way that this can be done? Thanks Geoff Caplan Caplan Associates

« previous php.general (#45721) next »