Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60076 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82038 invoked from network); 17 Apr 2012 11:47:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Apr 2012 11:47:33 -0000 Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.22 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.22 smtp2.ist.utl.pt Linux 2.6 Received: from [193.136.128.22] ([193.136.128.22:51281] helo=smtp2.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 17/72-03996-4585D8F4 for ; Tue, 17 Apr 2012 07:47:32 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 368B270003C5 for ; Tue, 17 Apr 2012 12:47:29 +0100 (WEST) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp2.ist.utl.pt ([127.0.0.1]) by localhost (smtp2.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id VsmPFsCeGUkB for ; Tue, 17 Apr 2012 12:47:28 +0100 (WEST) Received: from nebm.ist.utl.pt (unknown [IPv6:2001:690:2100:4::58:1]) by smtp2.ist.utl.pt (Postfix) with ESMTP id ED48F7000435 for ; Tue, 17 Apr 2012 12:47:28 +0100 (WEST) Received: from localhost ([127.0.0.1] helo=slws007.slhq.int) by nebm.ist.utl.pt with esmtp (Exim 4.72) (envelope-from ) id 1SK6sa-0006Pr-RQ for internals@lists.php.net; Tue, 17 Apr 2012 12:47:28 +0100 Content-Type: text/plain; charset=utf-8; format=flowed; delsp=yes To: internals@lists.php.net References: Date: Tue, 17 Apr 2012 13:47:28 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Organization: =?utf-8?Q?N=C3=BAcleo_de_Eng=2E_Biom=C3=A9di?= =?utf-8?Q?ca_do_I=2ES=2ET=2E?= Message-ID: In-Reply-To: User-Agent: Opera Mail/11.62 (Win32) Subject: Re: [PHP-DEV] is_numeric_string an hexadecimal numbers ("123" == "0x7B") From: glopes@nebm.ist.utl.pt ("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 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