note 43535 added to language.constants
| From: | the_coder at colina2004 dot com | Date: | Thu, 24 Jun 2004 17:42:13 +0000 |
| Subject: | note 43535 added to language.constants | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-71611@lists.php.net to get a copy of this message | ||
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]);
}
----
Manual Page -- http://www.php.net/manual/en/language.constants.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43535
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43535&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43535&report=yes
Search -- http://master.php.net/manage/user-notes.php