Re: [RFC] Add "is_representable_as_float()" and "is_representable_as_int()" functions

From: Date: Tue, 26 Aug 2025 17:16:38 +0000
Subject: Re: [RFC] Add "is_representable_as_float()" and "is_representable_as_int()" functions
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-128563@lists.php.net to get a copy of this message
Hi Larry, > I have multiple times just recently had need of "I have a numeric string, should I cast it > to an int or a float?", for which an is_representable_as_int() function (or similar) would be > quite helpful, and neater than the messy solution I usually use. Indeed, this is a nice use case! This is also something I encountered a few times. > I haven't had a use for is_representable_as_float() that I can recall. Just thinking out loud, if this RFC ever makes it to the voting phase, maybe we should have two separate votes, one for each function. Best, Alexandre Daubois

« previous php.internals (#128563) next »