ID: 47499 Comment by: crrodriguez at opensuse dot org Reported By: mpb dot mail at gmail dot com Status: Open Bug Type: Unknown/Other Function Operating System: Linux PHP Version: 5.2.8 New Comment:
$x is an integer, and 'foo' is a string in the first case..which gets casted to an integer so it can be compared... it is the expected behavior... Previous Comments: ------------------------------------------------------------------------ [2009-02-25 00:16:12] mpb dot mail at gmail dot com Description: ------------ When switching on 0 (zero), control flow executes the wrong case. Reproduce code: --------------- <?php $x = 0; switch ($x) { case 'foo': print "foo == $x ?\n"; break; case 0: print "0 == $x ?\n"; break; default: print "default: \$x == $x ?\n"; break; } ?> Expected result: ---------------- 0 == 0 ? Actual result: -------------- foo == 0 ? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=47499&edit=1