note 48930 deleted from language.constants by danbrown

From: Date: Tue, 26 Jul 2011 20:04:57 +0000
Subject: note 48930 deleted from language.constants by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-181911@lists.php.net to get a copy of this message
Note Submitter: Charles ---- To clarify from the previous post: When you define a constant, it becomes fixed at that point and is immutable. You can add variables - but the constant becomes the contents of that variable when the define is evaluated. If you try: define( "_A_TEXT" , "The value is " . $arr[$i] ); It would be evaluated ONCE with the current value of the $i index of array $arr. As the post pointed out, this is probably not what you want. You can easily create: define( "_A_TEXT" , "The value is "); .... echo _A_TEXT . $arr[$i]; Which would give you what you wanted: the constant string with the contents of the array appended.

« previous php.notes (#181911) next »