user3733648 user3733648 - 15 days ago 6
MySQL Question

PHP language based setting

I am creating a MySQL + PHP script where user can configure lanuage based formates

like

dateformat: dd.mm.yyyy
delimiter: ,
currency: €
locale: de


Is there any standard available for such configurations?

Answer

If you mean already built-in in php, yes there is a standard available. It works with locales. You can use the setlocale() function, to set the current locale, which has an impact on different php functions, like strftime(). Get a closer look here.

But be warned. The output is not always what you would expect, because it is not ISO compliant. There has been a long discussion about the locales and their impact on date functions, but in the end they decided to stay POSIX compliant, which is not ISO compliant.