Re: [RFC] Add "is_representable_as_float()" and "is_representable_as_int()" functions
| From: | Alexandre Daubois | Date: | Wed, 30 Jul 2025 06:43:46 +0000 |
| Subject: | Re: [RFC] Add "is_representable_as_float()" and "is_representable_as_int()" functions | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-128314@lists.php.net to get a copy of this message | ||
> Since frameworks already have things like Strings::is_stringable() and Arr::arrayable(),
> I'd suggest to use is_floatable(), is_intable() or is_integerable(), etc.
> To me, this would also feel more consistent is is_float(), is_int(), etc.
I get what you mean. Naming is definitely challenging here. However,
with alternatives like "is_floatable()", I'm afraid that it is not
clear enough that there's a potential loss of precision. I would
personally feel that "is_floatable()" would mean "can this be cast to
float?" without further "limitation".
Best,
Alexandre Daubois