RE: [PHP] convert degrees to heading

From: Date: Mon, 13 Sep 2004 19:24:54 +0000
Subject: RE: [PHP] convert degrees to heading
Groups: php.general 
Request: Send a blank email to php-general+get-196558@lists.php.net to get a copy of this message
[snip] The cleanest looking multiple "if" scenario is to use a "Switch" statement. Unfortunately I don't believe PHP's "switch" will do varied conditions, only equality statements: $j = 5; switch ($j) { case "< 6": echo "first"; break; case <6: echo "second"; break; case 5: echo "third"; break; default: echo "fourth"; break; } [/snip] Hmmm, what about this...seems to work fine.... $j = 7; switch($j){ case $j < 6: echo $j . " is less than 6\n"; break; } Alter the value of $j to see the results, the above example forgets to compare $j in each case.

« previous php.general (#196558) next »