I'm coding a multi language website. The text for each page is loaded from a MySQL database and should be assigned to an array or constant to insert it into the web content.
I would like to know if it is better, to save memory and for best performance, the use of constants or arrays to store the text. i.e.
foreach ($db_text_object as $t){
$text["$t->key"] = $t->text;
}
or:
foreach ($db_text_object as $t){
define($t->key, $t->text);
}
To be used as:
echo $text['mytext'];
or:
echo mytext;
Any other comment about advantage or disadvantage of each method will be appreciated.
Thank you.
phpfrom the command line so you do not have to manually reload the website multiple times.