Bug #72087 [Com]: case $var !== 0 return wrong answer (only with 0)

From: Date: Sat, 23 Apr 2016 16:46:28 +0000
Subject: Bug #72087 [Com]: case $var !== 0 return wrong answer (only with 0)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-200718@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72087&edit=1 ID: 72087 Comment by: sklogika2 at gmail dot com Reported by: sklogika2 at gmail dot com Summary: case $var !== 0 return wrong answer (only with 0) Status: Open Type: Bug Package: *Programming Data Structures Operating System: Centos7 PHP Version: 5.6.20 Block user comment: N Private report: N New Comment: I'm sorry instead of case 'userIdKOZqAfk': should be default: But idea is about !=0 Previous Comments: ------------------------------------------------------------------------ [2016-04-23 16:44:00] sklogika2 at gmail dot com Description: ------------ In the code below I get result of "not zero" when I should get "zero" Such case comparisons do not work properly only with 0, with other numbers it is ok Test script: --------------- $userId = 0; switch ($userId) { case $userId !== 0: echo "not zero"; break; case 'userIdKOZqAfk': echo "zero"; break; } Expected result: ---------------- zero Actual result: -------------- not zero ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=72087&edit=1

« previous php.bugs (#200718) next »