Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:72539 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13912 invoked from network); 13 Feb 2014 03:58:12 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Feb 2014 03:58:12 -0000 X-Host-Fingerprint: 72.91.185.17 pool-72-91-185-17.tampfl.fios.verizon.net Received: from [72.91.185.17] ([72.91.185.17:20157] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C8/81-19387-0D24CF25 for ; Wed, 12 Feb 2014 22:58:08 -0500 Message-ID: To: internals@lists.php.net Date: Wed, 12 Feb 2014 22:58:05 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 72.91.185.17 Subject: [RFC] Combined Comparison Operator From: davey@php.net (Davey Shafik) Hey folks, I've written up an RFC/Patch to gauge interest and get feedback on the addition of a combined comparison (aka: spaceship) operator. You can see the RFC at: https://wiki.php.net/rfc/combined-comparison-operator This adds a new operator "(expr) <=> (expr)" that returns 0 if both operands are equal, 1 if the left is greater, and -1 if the right is greater. It works with all types (just as well as <, <=, >=, > work) and is great for usort() callbacks for example. Code available here (against 5.6): https://github.com/dshafik/php-src/compare/add-spaceship-operator I'd love to get this into 5.6, not sure if we hit feature freeze yet. Also, not sure if it needs 2/3 majority, but assumed so as pow did? Thoughts? If there is interest, I'll start adding tests. They should be fairly trivial. - Davey