Skip to content

number_format() changed undocumented behaviour since PHP 8.3.0 #13866

Closed
@langemeijer

Description

@langemeijer

Description

https://3v4l.org/ELBNR

The following code:

<?php

echo number_format(3.1415, -1, ".", ",");

Resulted in this output since PHP 8.3.0:

0

But I expected this output instead:

3

No such change has been documented in https://www.php.net/manual/en/function.number-format.php

I understand -1 is not an expected value for $decimals, but if this change is intended I would have expected a E_WARNING or E_DEPRECATED before.

PHP Version

PHP 8.3.0

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions