|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-10-11 15:59 UTC] tony2001@php.net
[2006-10-11 16:13 UTC] bobson at rpg dot pl
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 22:00:01 2025 UTC |
Description: ------------ When converting to float from string, its always use "." as a decimal separator, but echo shows decimal separator using locale definition. Because of that there's a problem eg. in dbase function on numeric(float) fields. Reproduce code: --------------- setlocale(LC_ALL,"pl_PL"); echo '1.2*1='; echo "1.2"*1; //produce 1.2*1=1,2 echo '1,2*1='; echo "1,2"*1; //produce 1,2*1=1 <- this was expected to produce 1,2 float on pl_PL (in PL decimal separator is ",") setlocale(LC_ALL,"en_EN"); echo '1.2*1='; echo "1.2"*1; //produce 1.2*1=1.2 echo '1,2*1='; echo "1,2"*1; //produce 1,2*1=1 <- correct on en_EN //the most ugly examlpe setlocale(LC_ALL,"pl_PL"); echo (("1.2"*1)."")*1; //produce 1 echo (("1,2"*1)."")*1; //also produce 1 Expected result: ---------------- on pl_PL 1 1,2 on en_EN 1.2 1 last one example code: 1 1,2 Actual result: -------------- on pl_PL 1,2 1 on en_EN 1.2 1 last one example code: 1 1