Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:46700 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 1313 invoked from network); 13 Jan 2010 16:49:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Jan 2010 16:49:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 209.85.220.227 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.220.227 mail-fx0-f227.google.com Received: from [209.85.220.227] ([209.85.220.227:46161] helo=mail-fx0-f227.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 64/D9-00773-A89FD4B4 for ; Wed, 13 Jan 2010 11:49:15 -0500 Received: by fxm27 with SMTP id 27so735972fxm.23 for ; Wed, 13 Jan 2010 08:49:11 -0800 (PST) Received: by 10.223.74.129 with SMTP id u1mr2804295faj.63.1263401350224; Wed, 13 Jan 2010 08:49:10 -0800 (PST) Received: from ?192.168.200.22? (c-98-234-184-167.hsd1.ca.comcast.net [98.234.184.167]) by mx.google.com with ESMTPS id 15sm985737fxm.2.2010.01.13.08.49.08 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 13 Jan 2010 08:49:09 -0800 (PST) Message-ID: <4B4DF982.3020308@lerdorf.com> Date: Wed, 13 Jan 2010 08:49:06 -0800 User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: RQuadling@googlemail.com CC: PHP internals References: <10845a341001130802l49d7df07g7ecf846d9867193b@mail.gmail.com> In-Reply-To: <10845a341001130802l49d7df07g7ecf846d9867193b@mail.gmail.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Numerical string comparison - octal and hex. From: rasmus@lerdorf.com (Rasmus Lerdorf) Richard Quadling wrote: > Hello. > > In looking at numer vs string comparison, I think I've found an oddity. > > You can successfully compare hex strings ... > > var_dump(255 == '0xff'); > > but not octal strings ... > > var_dump(63 == '077'); > > > Is this a bug (lack of octal support) or an unexpected feature (hex support)? We don't have octal strings in PHP. Only native octal. eg. var_dump(63 == 077); Why? Mostly because octal strings is more likely to cause incorrect behaviour than both regular numeric strings and hex strings. -Rasmus