Re: [RFC] Combined Comparison (Spaceship) Operator

From: Date: Fri, 23 Jan 2015 00:16:34 +0000
Subject: Re: [RFC] Combined Comparison (Spaceship) Operator
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hi all,

On Fri, Jan 23, 2015 at 7:48 AM, Larry Garfield <[email protected]>
wrote:

> The examples say nothing about mixing types, though.  Eg, what would these
> return:
>
> return 0 <=> "0"
>
> return "" <=> 0
>
> return 1 <=> [1, 2, 3]
>
> Ignoring object property names and going by the order of the property
> definition seems like asking for trouble, too.
>

It should be the same as '===', IMO.
Only the same type should return 0.
Object has the same id should return 0.
Arrays would be matter of discussion.

Regards,

--
Yasuo Ohgaki
[email protected]


Thread (30 messages)

« previous php.internals (#81005) next »