View Single Post
Old 11-12-2010, 04:22 AM  
goodsites
Confirmed User
 
Industry Role:
Join Date: Jan 2010
Location: Over the rainbows
Posts: 538
php guru, convert function puzzle

I need this stored function converted into a regular php function, i get a bit confused on it

SET x = sin(lat1 * pi/180) * sin(lat2 * pi/180) + cos(lat1 *pi/180) * cos(lat2 * pi/180) * cos(abs((lon2 * pi/180) - (lon1 * pi/180)));
SET x = atan((sqrt(1- power(x,2))) /x);
RETURN (1.852 * 60.0 * ((x/pi)*180)) / 1.609344;


so something like function _getDistance($lat1, $lon1, $lat2, $lon2) {

..fill in here with answer please


Thanks in advance.
goodsites is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote