Hi Frendz,
How to convert the direction in degrees to normal directions(North,East..) in php

Yes. This is the code

<?php 
$brng=$rs['degree'];
$bearings = array("NE", "E", "SE", "S", "SW", "W", "NW", "N");

$index = $brng - 22.5;
if ($index < 0)
$index += 360;
$index = (int)($index / 45);
echo "Towards ".$bearings[$index];
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.