Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72555 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69125 invoked from network); 13 Feb 2014 11:04:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Feb 2014 11:04:55 -0000 Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.215.10 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.215.10 mail.experimentalworks.net Received: from [217.114.215.10] ([217.114.215.10:45490] helo=mail.experimentalworks.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AA/68-27664-5D6ACF25 for ; Thu, 13 Feb 2014 06:04:54 -0500 Received: from [192.168.2.31] (ppp-88-217-65-62.dynamic.mnet-online.de [88.217.65.62]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: johannes@schlueters.de) by mail.experimentalworks.net (Postfix) with ESMTPSA id 3E0B83FE91; Thu, 13 Feb 2014 12:05:31 +0100 (CET) To: Davey Shafik Cc: internals@lists.php.net, Yasuo Ohgaki In-Reply-To: <52FC4C8B.1040303@php.net> References: <52FC4C8B.1040303@php.net> Content-Type: text/plain; charset="UTF-8" Date: Thu, 13 Feb 2014 12:04:48 +0100 Message-ID: <1392289488.3990.86.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Combined Comparison Operator From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Wed, 2014-02-12 at 23:39 -0500, Davey Shafik wrote: > function ($left, $right) { > if ($left[1] == $right[1]) { > return 0; > } > > if ($left[1] > $right[1]) { > return 1; > } > > if ($left[1] < $right[1]) { > return -1; > } > } > > or (as per the RFC): > > function ($left, $right) { > return $left[1] <=> $right[1]; > } > while that example is overly nice - in real world outside a usort callback the consumer of the function in most cases still has to do the three if cases to use the result. So in practical terms it is limited to usort() and then it is a custom operator people reading the code most likely have to lookup. Typically in PHP we try to have identifiers which can be found via Google, Google doesn't handle "special" characters well. johannes