Re: [PHP-DEV] is_numeric_string an hexadecimal numbers ("123" == "0x7B")

2012-04-17 Thread Simon Schick
2012/4/17 Simon Schick > > 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

Re: [PHP-DEV] is_numeric_string an hexadecimal numbers ("123" == "0x7B")

2012-04-17 Thread Robert Williams
On 4/17/12 08:17, "Nikita Popov" wrote: >The last one is more problematic. It is explicitly documented as >accepting hexadecimal numbers. In my eyes it too should not accept >them, but I could imagine that people rely on this. This always struck me as mistaken design. Why accept hex or decimal,

Re: [PHP-DEV] is_numeric_string an hexadecimal numbers ("123" == "0x7B")

2012-04-17 Thread Nikita Popov
On Tue, Apr 17, 2012 at 1:44 PM, Gustavo Lopes wrote: > On Tue, 17 Apr 2012 13:20:33 +0200, Nikita Popov > wrote: > >> The internal is_numeric_string [1] function is used to check whether a >> string contains a number (and to extract that number). >> >> Currently is_numeric_string also accepts he

Re: [PHP-DEV] is_numeric_string an hexadecimal numbers ("123" == "0x7B")

2012-04-17 Thread Robert Williams
On Apr 17, 2012, at 5:39, "Hartmut Holzgraefe" mailto:hartmut.holzgra...@gmail.com>> wrote: Same here, i never even knew that this worked in a string context until recently. Autocast/comparison rules are already complicated enough as they are documented now, and i failed to find anything in the m

Re: [PHP-DEV] is_numeric_string an hexadecimal numbers ("123" == "0x7B")

2012-04-17 Thread Hartmut Holzgraefe
On 04/17/2012 01:20 PM, Nikita Popov wrote: > I don't think this has much BC impact, so it should be possible to change it. Same here, i never even knew that this worked in a string context until recently. Autocast/comparison rules are already complicated enough as they are documented now, and i

Re: [PHP-DEV] is_numeric_string an hexadecimal numbers ("123" == "0x7B")

2012-04-17 Thread Simon Schick
2012/4/17 Gustavo Lopes : > > 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 t

Re: [PHP-DEV] is_numeric_string an hexadecimal numbers ("123" == "0x7B")

2012-04-17 Thread Gustavo Lopes
On Tue, 17 Apr 2012 13:35:48 +0200, Simon Schick wrote: 2012/4/17 Nikita Popov 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 str

Re: [PHP-DEV] is_numeric_string an hexadecimal numbers ("123" == "0x7B")

2012-04-17 Thread Gustavo Lopes
On Tue, 17 Apr 2012 13:20:33 +0200, Nikita Popov wrote: The internal is_numeric_string [1] function is used to check whether a string contains a number (and to extract that number). Currently is_numeric_string also accepts hexadecimal strings [2] (apart from the normal decimal integers and d

Re: [PHP-DEV] is_numeric_string an hexadecimal numbers ("123" == "0x7B")

2012-04-17 Thread Simon Schick
2012/4/17 Nikita Popov > > var_dump('123' == '0x7b'); // true > > In all other parts of the engine hexadecimal strings are not recognized > [3]: > > var_dump((int) '0x7b'); // int(0) > Hi, Nikita I personally would rather change the type-conversion for strings to integer ... At least if you forc

Re: [PHP-DEV] is_numeric_string an hexadecimal numbers ("123" == "0x7B")

2012-04-17 Thread Pierre Joye
hi! On Tue, Apr 17, 2012 at 1:20 PM, Nikita Popov wrote: >  [3]: > http://www.php.net/manual/en/language.types.string.php#language.types.string.conversion >From the manual: "If the string starts with valid numeric data, this will be the value used. Otherwise, the value will be 0 (zero). Valid

[PHP-DEV] is_numeric_string an hexadecimal numbers ("123" == "0x7B")

2012-04-17 Thread Nikita Popov
Hi internals! The internal is_numeric_string [1] function is used to check whether a string contains a number (and to extract that number). Currently is_numeric_string also accepts hexadecimal strings [2] (apart from the normal decimal integers and doubles). This can cause some quite odd behavio