Question concerning SWITCH and Comparisons

From: Date: Thu, 11 Nov 2004 17:35:24 +0000
Subject: Question concerning SWITCH and Comparisons
Groups: php.windows 
Request: Send a blank email to php-windows+get-24965@lists.php.net to get a copy of this message
If my understanding of SWITCH is correct, it stops at the first case that matches the result, correct? So then.. If I have a switch as such; switch($qty){ case ($qty < 1600): //$qty is less than 1600 do something break; case ($qty < 2400): //$qty is less than 2400 do something break; case ($qty >= 2400); //$qty is greater than or equal to 2400 do something break; default: do something break; } Then assuming $qty = 800, it should stop at the first case? right? a $qty of 1601 should stop at the second case? and a qty of greater than or equal to 2400 should stop at the last case? Am I correct with my switch statement then? My desired result is; If quantity is less than 1600 set price = whatever; or if quantity is equal to 1600 and less than 2400 set price = whatever, or finally if quantity is equal to or greater than 2400 set price = whatever. I'm having difficulties for whatever reason to come up with a proper comparison for the switch to work as described. Can someone help me iron out this small problem? Much thanks for the help, Tony D.

« previous php.windows (#24965) next »