In php, given a latitude and longitude point, a bearing (in degrees), and a distance (in feet or km or whatever) how do I figure out what the new lat lng point is? here is what I tried, but it's wrong.
function destinationPoint($lat, $lng, $brng, $dist) {
$meters = $dist/3.2808399; // dist in meters
$dist = $meters/1000; // dist in km
$rad = 6371; // earths mean radius
$dist = $dist/$rad; // convert dist to angular distance in radians
$brng = deg2rad($brng); // conver to radians
$lat1 = deg2rad($lat);
$lon1 = deg2rad($lng);
$lat2 = asin(sin($lat1)*cos($dist) + cos($lat1)*sin($dist)*cos($brng) );
$lon2 = $lon1 + atan2(sin($brng)*sin($dist)*cos($lat1),cos($dist)-sin($lat1)*sin($lat2));
$lon2 = ($lon2+3*M_PI) % (2*M_PI) - M_PI; // normalise to -180..+180º
$lat2 = rad2deg($lat2);
$lon2 = rad2deg($lon2);
echo "lat2 = ".$lat2."<br/>";
echo "lon2 = ".$lon2."<br/>";
}