Edit report at https://bugs.php.net/bug.php?id=60000&edit=1
ID: 60000 Comment by: giorgio dot liscio at email dot it Reported by: k at twojepc dot pl Summary: switch with int(0) Status: Open Type: Bug Package: *Programming Data Structures Operating System: Debian/Windows PHP Version: 5.3.6 Block user comment: N Private report: N New Comment: switch uses the == operator so bogus $var = 0; switch (true) { case $var === "abc": echo "abc"; break; case $var === "zxc": echo "zxc"; break; default: echo "def"; break; } Previous Comments: ------------------------------------------------------------------------ [2011-06-28 17:35:13] k at twojepc dot pl Description: ------------ Switch use first case element when we use integer zero value. Test script: --------------- <?php $var=0; switch ($var) { case "abc": echo "abc"; break; case "zxc": echo "zxc"; break; default: echo "def"; break; } Expected result: ---------------- def Actual result: -------------- abc ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60000&edit=1