|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-04-26 02:42 UTC] matrix at matrixscripts dot 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.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 22:00:01 2025 UTC |
Perhaps you misunderstood my report - what I posted SHOULD echo "filled equals zerofilled equals zero also" but it doesn't. Another example below: $filled = 0; switch($filled){ case $filled == 0: echo "filled equals 0" break; } $filled = 100; switch($filled){ case $filled == 100: echo "filled equals 100" break; } When that is executed, it returns "filled equals 100". It SHOULD have returned "filled equals 0filled equals 100" but it doesn't - the only explanation is a bug in the switch code. This is not a bogus bug report.Your code is bogus, this is correct: $filled = 0; switch ($filled) { case 0: echo "filled equals zero"; break; } Who told you you can use case $filled == 0: ? It's simply not ok.