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

From: Date: Sun, 10 Nov 2013 09:20:11 +0000
Subject: Re: [RFC] Comparison and conversion inconsistency - need more info
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-70076@lists.php.net to get a copy of this message
> > ----------------------------------- > > if (-1 < NULL) > >   echo 'NULL is smaller'; > > else > >   echo '-1 is smaller'; > > ----------------------------------- > > returns '-1 is smaller' as all of us expects. > > Please go over the conditions and the echos in this example one more > time. > I think I understand your argument as I know languages that treat null/nil as special value. > I just think  My argument in the above case is that the "friendly text" you are echoing is wrong -- backwards. > min(-10000, -1000, -100, NULL, 100, 1000) returns NULL. > is not following standard PHP comparison rules. It is. Never mind the 6 different vars, as the sort runs, it boils down to -10000 < NULL (bool)-10000 < (bool)NULL true < false --> false

« previous php.internals (#70076) next »