#38170 [Opn->Bgs]: if structure doing weird stuff

From: Date: Thu, 20 Jul 2006 23:38:29 +0000
Subject: #38170 [Opn->Bgs]: if structure doing weird stuff
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-99698@lists.php.net to get a copy of this message
ID: 38170 Updated by: helly@php.net Reported By: erick at vmxt dot com -Status: Open +Status: Bogus Bug Type: Variables related Operating System: Windows XP SP2 PHP Version: 5.1.4 New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php RTFM Previous Comments: ------------------------------------------------------------------------ [2006-07-20 22:30:24] erick at vmxt dot com Description: ------------ When comparing number zero with a not empty string, it returns true. Reproduce code: --------------- <?php $something = 0; if($something) { echo $something . "is true. <br />"; } if ("thestring") { echo "thestring is true" . "<br />"; } if ($something == "thestring") { echo "why?" . "<br />"; } if("thestring" == $something) { echo "again why?" . "<br />"; } ?> Expected result: ---------------- thestring is true Actual result: -------------- thestring is true why? again why? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38170&edit=1

« previous php.bugs (#99698) next »