note 43535 deleted from language.constants by danbrown
| From: | danbrown@php.net | Date: | Tue, 26 Jul 2011 20:05:06 +0000 |
| Subject: | note 43535 deleted from language.constants by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-181912@lists.php.net to get a copy of this message | ||
Note Submitter: the_coder at colina2004 dot com
----
I'm currently working on a site that has got to have two languages, and I wanted to use
define's in functions to make everything simpler.
However, I ran into a problem. PHP doesn't recognize the variable in:
define("constantName", "This is an array variable - {$array[$i][2]}");
I can't use that in a for cycle, like I wanted to:
for ($i = 0; $i < count($array); $i++) {
echo constantName . "<br />"
}
The method I found (I think it's been mentioned before) is to:
define("constantName", "This is an array variable - %s");
And then:
for ($i = 0; $i < count($array); $i++) {
printf(constantName, $array[$i][2]);
}