Re: [RFC] Combined Comparison Operator
| From: | Andrea Faulds | Date: | Thu, 13 Feb 2014 04:01:37 +0000 |
| Subject: | Re: [RFC] Combined Comparison Operator | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-72540@lists.php.net to get a copy of this message | ||
On 13/02/14 03:58, Davey Shafik wrote:
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.It's useful and cool, and adds an awesome new operator name ((T_SPACESHIP <=> T_PAAMAYIM_NEKUDOTAYIM) === 1), but would it be used often enough to justify addition? -- Andrea Faulds http://ajf.me/