On Tue, 17 Apr 2012 13:35:48 +0200, Simon Schick <simonsimc...@googlemail.com> wrote:

2012/4/17 Nikita Popov <nikita....@googlemail.com>

var_dump('123' == '0x7b'); // true

In all other parts of the engine hexadecimal strings are not recognized
[3]:

var_dump((int) '0x7b'); // int(0)


I personally would rather change the type-conversion for strings to integer ...
At least if you force it to do a type-cast (in other words: forcing to
get any valuable integer of that string) ...


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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to