|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12647 sprintf, doubles and locale
Submitted: 2001-08-08 08:03 UTC Modified: 2002-06-16 09:13 UTC
From: artur at 2i dot pl Assigned:
Status: Closed Package: Strings related
PHP Version: 4.0.6 OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
40 - 25 = ?
Subscribe to this entry?

 [2001-08-08 08:03 UTC] artur at 2i dot pl
sprintf ignores locale settings and always use . as the decimal separator.

Try this:

   setlocale("LC_NUMERIC", "pl_PL"); 
   echo sprintf("%.2f",doubleval("1,25"));

(should be 1,25)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-16 09:13 UTC]
fixed in CVS


  setlocale("LC_NUMERIC", "pl_PL"); 
  echo sprintf("%.2f",1.25);

will soon work (again?), too
no need to use the doubleval() workaround anymore

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Oct 04 23:01:25 2023 UTC