|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-10-13 04:26 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
-Package: *General Issues
+Package: Scripting Engine problem
[2015-10-13 04:26 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 11:00:02 2026 UTC |
Description: ------------ This code fails, 0 gets ignored and is catch by the 2nd case instead of the first one. Basically indicating than 0 is greater that 69. To evaluate a lower value you need to set it up to 1. $a = 0; switch ($a){ case ($a <= 69) : echo "Less than or equal 69"; break; case ($a > 69 && $a < 80) : echo "greater than 69" ; break; case ($a >= 80) : echo "greater or equal 80" ; break; } Test script: --------------- This code fails, 0 gets ignored and is catch by the 2nd case instead of the first one. Basically indicating than 0 is greater that 69. To evaluate a lower value you need to set it up to 1. $a = 0; switch ($a){ case ($a <= 69) : echo "Less than or equal 69"; break; case ($a > 69 && $a < 80) : echo "greater than 69" ; break; case ($a >= 80) : echo "greater or equal 80" ; break; } Expected result: ---------------- It should evaluate 0 as a value and it is not.