php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66898 number_format requests extra parameters while not mandatory
Submitted: 2014-03-13 11:43 UTC Modified: 2014-03-13 17:26 UTC
From: wildewouter at gmail dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.6.0alpha3 OS: Ubuntu 13.10
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: wildewouter at gmail dot com
New email:
PHP Version: OS:

 

 [2014-03-13 11:43 UTC] wildewouter at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.number-format
---

The final three parameters for the number_format function have a default but when only three of the parameters are filled in, the fourth has become mandatory and it returns null (no fatal error)

Test script:
---------------
<?php

var_dump(number_format((float) 1.6, 1, '.'));

Expected result:
----------------
This should output the string 1.6

Actual result:
--------------
This outputs NULL

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-03-13 17:26 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2014-03-13 17:26 UTC] requinix@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

The very first thing said in the documentation is
> This function accepts either one, two, or four parameters (not three):
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC