Re: [RFC] Comparison and conversion inconsistency - need more info

From: Date: Sun, 10 Nov 2013 22:51:27 +0000
Subject: Re: [RFC] Comparison and conversion inconsistency - need more info
References: 1 2 3 4 5 6 7 8 9  Groups: php.internals 
Request: Send a blank email to internals+get-70097@lists.php.net to get a copy of this message
On 10/11/2013 19:59, Sanford Whiteman wrote:
( -1 < true ) // false, because the two compare equal and the comparison must return a bool ( min( -1,true ) ) // -1, because the two compare equal and -1 was passed first ( min( true,-1 ) ) // true, because the two compare equal and true was passed first Absolutely consistent with documentation. Pay attention to the final return type of a simple comparison vs. comparisons wrapped in the min() function. -- S.
Thanks, I thought there was probably an obvious explanation. Effectively, they're equal, so which of them is lower is "undefined"; min() made one assumption (whichever came first), my dummy function with < made the other (whichever came second, because it fell into the else{}). -- Rowan Collins [IMSoP]

« previous php.internals (#70097) next »