Variables versus constants versus associative arrays in PHP

Posted by susmits on Stack Overflow See other posts from Stack Overflow or by susmits
Published on 2010-05-02T05:58:58Z Indexed on 2010/05/02 6:07 UTC
Read the original article Hit count: 524

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"]?

© Stack Overflow or respective owner

Related posts about php

Related posts about constants