Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:60522 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65092 invoked from network); 9 May 2012 08:09:34 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 May 2012 08:09:34 -0000 Authentication-Results: pb1.pair.com header.from=joe@joegillotti.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=joe@joegillotti.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain joegillotti.com designates 199.168.184.8 as permitted sender) X-PHP-List-Original-Sender: joe@joegillotti.com X-Host-Fingerprint: 199.168.184.8 purple.jrgp.us Received: from [199.168.184.8] ([199.168.184.8:56162] helo=purple.jrgp.us) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C8/31-55274-C362AAF4 for ; Wed, 09 May 2012 04:09:32 -0400 Received: by purple.jrgp.us (Postfix, from userid 58) id 4377D568AC; Wed, 9 May 2012 04:11:14 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on purple.jrgp.us X-Spam-Level: X-Spam-Status: No, score=-1.0 required=4.0 tests=ALL_TRUSTED autolearn=disabled version=3.3.2 Received: from adore.jrgp.us (rrcs-65-34-27-38.se.biz.rr.com [65.34.27.38]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by purple.jrgp.us (Postfix) with ESMTPSA id 4BD5656491 for ; Wed, 9 May 2012 04:11:06 -0400 (EDT) Message-ID: <4FAA262F.8030701@joegillotti.com> Date: Wed, 09 May 2012 04:09:19 -0400 Reply-To: joe@joegillotti.com User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.3) Gecko/20120329 Icedove/10.0.3 MIME-Version: 1.0 To: internals@lists.php.net References: <4F847B8A.9010007@sugarcrm.com> <733bc8ea59cf6737563a62886e92fcb6.squirrel@www.l-i-e.com> <4FA7C229.9080901@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [off] PHP: a fractal of bad design From: joe@joegillotti.com (Joe Gillotti) Nothing's stopping you from using === for integer comparison or validating your integer string using either ctype_digit() or is_numeric() before comparing it. (The difference between these two functions is is_numeric() allows for decimal points) On 05/07/2012 09:25 PM, Raymond Irving wrote: > I was very surprised when I came across the == issue sometime ago. IMO > strings should be compared as strings. They should never be converted to > integer. > > > 1=="1" // always convert the number value to a string and then > compare it > "foo" == 0 // should return false > > "123abc" == "123nth" // compare as string. Do not convert to numeric values > > "0"==0 // true > 0=="0." // false > > PHP is great but if we can work together to remove the flaws, then we can > make it even greater. We have to leave the past behind us and look at where > we want PHP to be in the next 5 years > > > Best regards, >