Re: [RFC] Preserve Fractional Part in JSON encode
| From: | Ferenc Kovacs | Date: | Mon, 05 Jan 2015 09:31:36 +0000 |
| Subject: | Re: [RFC] Preserve Fractional Part in JSON encode | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-80170@lists.php.net to get a copy of this message | ||
On Mon, Jan 5, 2015 at 5:18 AM, Juan Basso <jrbasso@gmail.com> wrote:
> Hi,
>
> Everyone has any concern on the constant name as Andrea mentioned? Should
> we keep or rename it? If this name is fine and there is no other concerns
> probably in 3 days (when completes 2 weeks) this RFC can be moved to
> voting, right?
>
>
> Thanks,
> Juan Basso
>
I prefer the originally proposed constant name
(JSON_PRESERVE_FRACTIONAL_PART) over JSON_FLOAT_ADD_POINT_ZERO.
I've did a quick check and we have a constant called
FILTER_FLAG_ALLOW_FRACTION so maybe JSON_PRESERVE_FRACTION would be a bit
simpler and consistent.
But that would still imply that without this option we truncate (non-zero)
fractional parts, so maybe something like JSON_PRESERVE_ZERO_FRACTION.
I think PRESERVE is better than ADD because we aren't really adding
something but making sure that it won't be lost through the json_encode.
--
Ferenc Kovács
@Tyr43l - http://tyrael.hu