Bug #16843 Updated: Switch fails when variable being switched equals zero

From: Date: Fri, 26 Apr 2002 07:18:11 +0000
Subject: Bug #16843 Updated: Switch fails when variable being switched equals zero
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-6067@lists.php.net to get a copy of this message
ID: 16843 Updated by: yohgaki@php.net Reported By: matrix@matrixscripts.com -Status: Open +Status: Bogus Bug Type: Variables related Operating System: Red Hat Linux PHP Version: 4.2.0 New Comment: The bug system is not the appropriate forum for asking support questions. For a list of a range of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php Previous Comments: ------------------------------------------------------------------------ [2002-04-26 02:42:05] matrix@matrixscripts.com The following lines of code produce this: "filled equals zero" $filled = 0; if($filled == 0){ echo "filled equals zero"; } switch($filled){ case $filled == 0: echo "filled equals zero also" break; } As far as I can tell, there is no reason why that case isn't satisfied - $filled DOES equal 0, as the if statement proves, yet "filled equals zero also" never appears on the page. However, replacing "case $filled == 0:" with "case 0:" does work. This can only be a bug. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=16843&edit=1

« previous php.bugs (#6067) next »