Re: rounding integers
| From: | David Gebler | Date: | Mon, 22 May 2023 21:38:56 +0000 |
| Subject: | Re: rounding integers | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120390@lists.php.net to get a copy of this message | ||
On Sun, May 21, 2023 at 4:21 PM Larry Garfield <larry@garfieldtech.com>
wrote:
>
> Having recently been bitten by floor() returning a float even though the
> value that comes back is logically an int, I would be fully in support of
> "and returns an int" versions of these functions in core.
>
What about adding a third, optional parameter to round() which is a flag
(or bitmask) to specify preferred behaviour and return type? Kind of ugly,
but maybe less ugly than another new function and no BC-break, as the
default can be the existing behaviour.
-Dave