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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 27 16:01:27 2024 UTC