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?

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.

Thank you both for response, it is very helpful.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.