Re: is_numeric_string an hexadecimal numbers ("123" == "0x7B")
| From: | Simon Schick | Date: | Tue, 17 Apr 2012 11:57:49 +0000 |
| Subject: | Re: is_numeric_string an hexadecimal numbers ("123" == "0x7B") | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-60078@lists.php.net to get a copy of this message | ||
2012/4/17 Gustavo Lopes <glopes@nebm.ist.utl.pt>:
>
> I think that would be an error. As was mentioned a few months ago when 0b
> was introduced, no other number format has this behavior. You can't do "123"
> == "0b10" or "123" == "0876". Extending this hexadecimal oddity
> instead of
> eliminating it is inconsistent with the treatment given to those other
> formats.
>
> --
> Gustavo Lopes
>
Hi, Gustavo
That's something I didn't know of ... if we're doing that, it should,
of course, be also be done for the dual system.
The only thing I wonder about is the code examples you're giving ...
I would expect this to work if we start to change something here:
var_dump((int) '0x7b'); // int(123)
var_dump((int) '0b1111011'); // int(123)
var_dump((int) '0123'); // int(123)
The last example was not mentioned here before but as you set in an
example, I did it here as well ...
Bye
Simon