Hi,

Alternatively, try :-

$Compass = array('West', 'North Westerly', 'North', 'North Easterly',
                        'East', 'South Easterly', 'South',
                        'South Westerly');

print $Compass[round($Degrees / 45)] . "\n";

This can be expanded easily by adding 'North North West' etc. at the
relevant points in the array and changing the 45 to 22.5.

No messy horrible switches :-)


TTFN,


Dave
php/2004-09-14.tx                              [EMAIL PROTECTED],
                                               php-general,[EMAIL PROTECTED]
+----------------------------------------------------------------------------+
| Dave Restall,       IIRC Limited, PO Box 46, Skelton, Cleveland, TS12 2GT. |
| Tel. 0845 10 80 151    Mob. +44 (0) 7973 831245   Int. +44 (0) 1287 653003 |
| email : [EMAIL PROTECTED]       [EMAIL PROTECTED]     Web : http://www.iirc.net |
+----------------------------------------------------------------------------+
| One picture is worth more than ten thousand words.                         |
|         -- Chinese proverb                                                 |
+----------------------------------------------------------------------------+

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to