PHP 4.0 Bug #8097: printf() and float data vs.setlocale()

From: Date: Mon, 04 Dec 2000 18:08:55 +0000
Subject: PHP 4.0 Bug #8097: printf() and float data vs.setlocale()
Groups: php.dev 
Request: Send a blank email to php-dev+get-40014@lists.php.net to get a copy of this message
From: hh@loca.net Operating system: Linux (SuSE 7.0) PHP version: 4.0.3pl1 PHP Bug Type: Unknown/Other Function Bug description: printf() and float data vs.setlocale() Changing the locale setting to a country that uses comma (,) as the decimal seperator will stip off decimal places from the float value in printf/sprintf. Example: MySQL table: create table test ( name varchar(100), value float(16,2) ); insert into test values ('bla', 3.789); PHP code: setlocale("LC_ALL", "de_DE"); // mysql_connect etc. $row = mysql_fetch_array($result); printf("%s: %.2f", $row["name"], $row["value"]); Result: bla: 3.00 -- Edit Bug report at: http://bugs.php.net/?id=8097&edit=1

« previous php.dev (#40014) next »