I have a question about using define(). I am using this function for other constants across my script ,but am looking at developing a set of language files. For example I was thinking of having one eng_defined.php and one fr_defined.php each containing the same named constants but the output would be in different languages. When the user selects to view the site in their language of choice it would display the value of the constant in that language, but then I wondered if an issue would turn up if I used define() this way?

8 Years
Discussion Span
Last Post by mom_of_3

If you make a single page (for example index.php) and include the language file depending on which language is wanted, this is a perfectly acceptable use of the define() function. as it will standardize the scripts.


I don't see a problem with this because either eng_defined.php OR fr_defined.php would be called, so it would behave just as if all of the constants were defined once. From then on, you can use define to see if the constant exists.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.