php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #73895 Missing format variation
Submitted: 2017-01-09 10:33 UTC Modified: 2017-01-09 10:48 UTC
Votes:4
Avg. Score:3.8 ± 1.1
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:1 (25.0%)
From: h dot larget at gmail dot com Assigned:
Status: Not a bug Package: *Math Functions
PHP Version: 7.0.14 OS: Ubuntu 16.04 LTS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: h dot larget at gmail dot com
New email:
PHP Version: OS:

 

 [2017-01-09 10:33 UTC] h dot larget at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.round
---

It is not specified that depending on php locale, the dot is replaced by comma.

it should not have this kind of behavior or being specified in the documentation.

Test script:
---------------
<?php echo "<br/>".round(2.447,2);

Expected result:
----------------
<br/>2.45

Actual result:
--------------
<br/>2,45

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-09 10:48 UTC] requinix@php.net
-Status: Open +Status: Not a bug -Package: Documentation problem +Package: *Math Functions
 [2017-01-09 10:48 UTC] requinix@php.net
It is not mentioned because it has nothing to do with round(). The comma is introduced when the floating-point value is converted to string.
http://php.net/manual/en/language.types.string.php#language.types.string.casting

echo 2.447; // 2.447
echo (string)2.447; // 2,447 with an appropriate locale
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Mar 08 23:01:23 2021 UTC