I’m working on a small project, and need to implement internationalization support somehow. I am thinking along the lines of using constants to define a lot of symbols for text in one file, which could be included subsequently. However, I’m not sure if using variables is faster, or if I can get away with using associative arrays without too much of a performance hit.
What’s better for defining constant values in PHP, performance-wise — constants defined using define("FOO", "..."), or simple variables like $foo = "...", or associative arrays like $symbols["FOO"]?
There’s not going to be any noticeable difference in performance so don’t worry about that. Do whatever is going to be easier to maintain.
Personally i’d go with an associative array if it’s not too complicated. If things are a little more complicated then use gettext.