Path: csiph.com!usenet.pasdenom.info!news.albasani.net!fu-berlin.de!uni-berlin.de!not-for-mail From: "M. Strobel" Newsgroups: comp.lang.php Subject: Re: A little tip Date: Mon, 02 Apr 2012 10:22:10 +0200 Lines: 40 Message-ID: <9tt5tiFfmoU1@mid.uni-berlin.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: news.uni-berlin.de D+UKfKDuFato0wQws7oFTAhYAvAhm6/J17txZHgwBrltFl0Lg= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20 In-Reply-To: Xref: csiph.com comp.lang.php:5304 Am 02.04.2012 09:42, schrieb "=C3=81lvaro G. Vicario": > El 30/03/2012 19:02, Shelly escribi=C3=B3/wrote: >> Here is something I jist came across, so I am passing it on: >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> $val=3D TRUE; >> $val &=3D TRUE; >> print ($val =3D=3D=3D TRUE) ? "Triple is true\n" : "Triple is false\n"= ; >> print ($val =3D=3D TRUE) ? "Double is true\n" : "Double is false\n"; >> >> Results in: >> Triple is false >> Double is true >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >> >> Who designed that? It is totally counter-intuitive. >=20 > When trying to understand these subtleties, I find var_dump() more usef= ul than plain > echos. In this case: >=20 > $val=3D TRUE; > var_dump($val); > $val &=3D TRUE; > var_dump($val); >=20 > ... prints: >=20 > bool(true) > int(1) >=20 > ... which makes the result of loose and strict comparisons obvious. >=20 Yes, and then he could print http://de2.php.net/manual/en/types.compariso= ns.php and nail it to the monitor. /Str.