Date: 09/26/00
- Next message: Account Service: "[PHP-I18N] Print Bankable Checks Yourself !"
- Previous message: Mijoiu Cristian Paul: "[PHP-I18N] PHP manual"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
I think I've found something that appears as a bug in PHP. It seems that the PHP code is parsed according to the locale set in the very code.
I came across this BUG in a project I developed recently. I set the locale to pl_PL (Polish) in one piece of code. In this locale the decimal symbol is represented by coma sign insted of dot.
In another piece of code, that was REQUIRED (ie. included with require instruction) it came out that I couldn't code fraction numbers! In polish, fraction numbers are stated with coma -- ie. for example 3,14 instead of 3.14.
The PHP parser required me to write fraction numbers with coma (from locale), which is already reserved as a list separator.
The walkaround I found is that you should code fractions using the division operation. The other (and much nicier) method would be swiching locale, but I haven't found the function to get the locale. So, although there is setlocale(), there isn't something like getlocale(). At least as much as I know.
If you want to recreate the bug, write the code:
setlocale("LC_ALL", "pl_PL"); // you have to have it installed
print strval(3.14); // prints "3"
-- PHP Internationalization Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-i18n-unsubscribe <email protected> For additional commands, e-mail: php-i18n-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Account Service: "[PHP-I18N] Print Bankable Checks Yourself !"
- Previous message: Mijoiu Cristian Paul: "[PHP-I18N] PHP manual"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

