note 100895 rejected from language.operators.comparison by danbrown
| From: | danbrown@php.net | Date: | Sat, 13 Nov 2010 17:08:15 +0000 |
| Subject: | note 100895 rejected from language.operators.comparison by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-174001@lists.php.net to get a copy of this message | ||
Note Submitter: piotr dot zywien at gmail dot com
----
Hi there... I have a question and need help, as the <= comparison operator seems to be giving
strange results...
Could anyone please tell me why the following statement, would produce output for the second case (
$percent > 20 && $percent <= 40 ) if $percent == 0? This really baffles me and I will
appreciate any help! Thanks upfront! Piotr.
switch( $percent )
{
case( $percent <= 20 ) : echo "$smileys_base/sno.png"; break;
case( $percent > 20 && $percent <= 40 ) : echo
"$smileys_base/no.png"; break;
case( $percent > 40 && $percent <= 60 ) : echo
"$smileys_base/ok.png"; break;
case( $percent > 60 && $percent <= 80 ) : echo
"$smileys_base/yes.png"; break;
case( $percent > 80 && $percent <= 100 ) : echo
"$smileys_base/syes.png"; break;
}