Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70172 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10364 invoked from network); 16 Nov 2013 11:22:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Nov 2013 11:22:53 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@marc-bennewitz.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@marc-bennewitz.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain marc-bennewitz.de from 80.237.132.171 cause and error) X-PHP-List-Original-Sender: php@marc-bennewitz.de X-Host-Fingerprint: 80.237.132.171 wp164.webpack.hosteurope.de Received: from [80.237.132.171] ([80.237.132.171:50404] helo=wp164.webpack.hosteurope.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 73/80-06017-B8557825 for ; Sat, 16 Nov 2013 06:22:52 -0500 Received: from dslb-088-072-020-203.pools.arcor-ip.net ([88.72.20.203] helo=[192.168.178.27]); authenticated by wp164.webpack.hosteurope.de running ExIM with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) id 1Vhdxg-0002DM-LR; Sat, 16 Nov 2013 12:22:48 +0100 Message-ID: <52875587.6050000@marc-bennewitz.de> Date: Sat, 16 Nov 2013 12:22:47 +0100 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: internals@lists.php.net References: <527DF228.1080108@sugarcrm.com> <416659913.20131110035553@cypressintegrated.com> <127298508.20131110042057@cypressintegrated.com> <97776909.20131110045342@cypressintegrated.com> <527FDE61.70102@gmail.com> <346085145.20131110145938@cypressintegrated.com> <52812873.70406@gmail.com> <1755993748.20131111140340@cypressintegrated.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-bounce-key: webpack.hosteurope.de;php@marc-bennewitz.de;1384600971;b4a60e33; Subject: Re: [PHP-DEV] [RFC] Comparison and conversion inconsistency - need more info From: php@marc-bennewitz.de (Marc Bennewitz) Hi, What about the following PHP logic: var_dump(null == 0); // TRUE var_dump(null < -1); // TRUE var_dump(null > -1); // FALSE How can you explain that ? Greetings Marc Am 15.11.2013 00:03, schrieb Yasuo Ohgaki: > Hi all, > > On Tue, Nov 12, 2013 at 4:03 AM, Sanford Whiteman < > swhitemanlistens-software@cypressintegrated.com> wrote: > >>> You don't have to think the current documentation is awful to find ways >>> of improving it. >> >> Sure, go for it! > > > I wrote my misunderstanding to my personal blog. It seems many people > misunderstand it, just like me :) > > Any improvement/correction? > min() manual page is better to be updated. I'll add min() example blow to > min() manual > page also. > > Index: operators.xml > =================================================================== > --- operators.xml (リビジョン 332115) > +++ operators.xml (作業コピー) > @@ -1262,7 +1262,7 @@ > > bool or null > anything > - Convert to bool, &false; < &true; > + Convert to bool both side, &false; < > &true; > > > object > @@ -1298,8 +1298,28 @@ > > > > + > > > + Boolean/null comparison > + > + + +// Bool and null are compared as bool always > +var_dump(1 == TRUE); // TRUE - same as (bool)1 == TRUE > +var_dump(0 == FALSE); // TRUE - same as (bool)0 == FALSE > +var_dump(100 < TRUE); // FALSE - same as (bool)100 < TRUE > +var_dump(-10 < FALSE);// FALSE - same as (bool)-10 < FALSE > +var_dunp(min(-100,-10, NULL, 10, 100); // NULL - (bool)NULL < (bool)-100 > is FALSE < TRUE > +?> > +]]> > + > + > + > + > + > + > + > Transcription of standard array comparison > >