Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81003 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84737 invoked from network); 22 Jan 2015 23:52:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Jan 2015 23:52:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.207 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.207 imap2-2.ox.privateemail.com Received: from [192.64.116.207] ([192.64.116.207:51827] helo=imap2-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 94/A4-61273-F4D81C45 for ; Thu, 22 Jan 2015 18:52:47 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 2A1FD8C0069; Thu, 22 Jan 2015 18:52:44 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap2.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap2.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id unfkKv-JEYCz; Thu, 22 Jan 2015 18:52:44 -0500 (EST) Received: from oa-res-26-240.wireless.abdn.ac.uk (oa-res-26-240.wireless.abdn.ac.uk [137.50.26.240]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 623EF8C007D; Thu, 22 Jan 2015 18:52:43 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) In-Reply-To: <54C18C01.9090907@garfieldtech.com> Date: Thu, 22 Jan 2015 23:52:40 +0000 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <0D29BE16-F55D-4B0C-BEBA-FBB9A2BF3992@ajf.me> References: <53F8A1FF-C809-4DDF-9C6F-6916C3E4F044@ajf.me> <3251D635-D97C-4738-B537-935A6CC21E19@ajf.me> <54C17E2B.80708@garfieldtech.com> <73BC4206-BEA9-4416-BBB6-F6F99D9A8623@ajf.me> <54C18C01.9090907@garfieldtech.com> To: Larry Garfield X-Mailer: Apple Mail (2.1993) Subject: Re: [PHP-DEV] [RFC] Combined Comparison (Spaceship) Operator From: ajf@ajf.me (Andrea Faulds) Hi again, > On 22 Jan 2015, at 23:47, Larry Garfield = wrote: >=20 > Assuming it's accurate and I'm understanding you correctly, I think = the following would be a sufficient statement for the RFC: >=20 > ----- > The behavior of this operator with mixed types is such that the = following two snippets produce the exact same result in all cases: >=20 > return $a <=3D> $b; >=20 > if ($a > $b) { > return -1; > } > elseif ($a < $b) { > return 1; > } > else { > return 0; > } > ----- >=20 > Or maybe that's implicit in the existing link, I'm not sure. (Now = that I read it over again.) Basically, in order to understand the more = esoteric type juggling that may occur you'd need to mentally expand it = to its "uncompressed form", for which the rules are already defined (if = possibly quirky in some cases). Yes, that=E2=80=99s correct. Although it would be more accurate to say = that ($a < $b) is just ($a <=3D> $b =3D=3D=3D -1), ($a > $b) is just ($a = <=3D> $b =3D=3D=3D 1) and similar things for >=3D and <=3D, as that=E2=80=99= s how the comparison operators work internally (with the exception of =3D=3D= which also has a fast case). I think I=E2=80=99ll add something along those lines to the RFC. Thanks. -- Andrea Faulds http://ajf.me/