Re: [RFC] Combined Comparison (Spaceship) Operator
| From: | Yasuo Ohgaki | Date: | Fri, 23 Jan 2015 00:43:29 +0000 |
| Subject: | Re: [RFC] Combined Comparison (Spaceship) Operator | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-81010@lists.php.net to get a copy of this message | ||
Hi Andrea,
On Fri, Jan 23, 2015 at 9:24 AM, Andrea Faulds <ajf@ajf.me> wrote:
> Having it be the same as === would be inconsistent with our existing
> sorting and comparison behaviour, so I don’t think it should be changed. If
> we made it strict like that, we’d also have to define a strict < and > as
> well, otherwise we have a problem, because in some cases ($x !== $y && !($x
> < $y) && !($x > $y)) is TRUE.
Ok. Now I understand. Since we don't/can't define strictly typed
less/greater than operator,
it makes sense. It can be handles
if (get_type($a) != get_type($b)) { ... treat it as exception/error etc }
return $a <=> $b;
Regards,
--
Yasuo Ohgaki
yohgaki@ohgaki.net