Edit report at http://bugs.php.net/bug.php?id=54652&edit=1
ID: 54652 Comment by: felipecg00 at gmail dot com Reported by: rdli dot data at gmail dot com Summary: Bug when switch expression is zero Status: Open Type: Bug Package: Unknown/Other Function PHP Version: 5.3SVN-2011-05-02 (SVN) Block user comment: N Private report: N New Comment: ($price > 100) is false. false is 0, then case is executed. Previous Comments: ------------------------------------------------------------------------ [2011-05-02 22:54:12] rdli dot data at gmail dot com Description: ------------ //execute function parameter with $price = 0 myPrice(0); Test script: --------------- function myPrice($price = 50 ){ switch ($price) { case ($price > 100) : echo $price, '<br />'; echo "Price is $100 up."; break; case ($price > 50) : echo "Prince is $50 up."; break; case ($price >25): echo "Prince is $25 up."; break; default: echo "Prince is no more then $25."; break; } } Expected result: ---------------- Prince is no more then $25. Actual result: -------------- 0 Price is $100 up. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=54652&edit=1