Hi Gina, Le jeu. 24 juil. 2025 à 14:46, Gina P. Banyard <intern...@gpb.moe> a écrit : > > Hello internals, > > I'm mailing the list for the bike shed of the naming of a new constant I > think we should introduce in PHP which I'm currently calling PHP_INT_MAX_SAFE. > The purpose of this integer is to indicate what is the maximal integer value > that can be correctly represented by a float. > On 32 bits this is equal to PHP_INT_MAX, but on 64 bits it is > 9007199254740991 (which is 2^(53) – 1) as the mantissa of a floating point > number is 52 bits.
What about an actual function returning if an integer is safe or not? We actually ran into this lately with the JsonPath component of Symfony. I wrote a userland function for this: https://github.com/symfony/symfony/blob/d3a0df0243e1c68598fa066eaa6cd0cf39f256dc/src/Symfony/Component/JsonPath/JsonPathUtils.php#L243 Given the numerous interactions between PHP and JSON, I think it would be useful to have a function like "is_safe_integer()". Best, Alex