WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Latitude-Longitude to Miles
Categories : PHP, Utilities, Math. Update Picture
Farrukh Shahzad
Date : Feb 14th 2001
Grade : 2 of 5 (graded 2 times)
Viewed : 9659
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Farrukh Shahzad
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

/* Author: Farrukh Shahzad */
// This function was originally written by R.V. as
// shown on the algorithm section of code gallery (http://www.zend.com/codex.php?
id=32&single=1).
// I tried that function and found that it is not given the same answer (I dont know whether
Raplh's math is right)
// as given by my function shown below.
//Also It is much simpler math and gives direction of 2nd point with respect first

function calcMiles($lat1, $lon1, $lat2, $lon2) {

$deg2mile = 69.09; //for earth
$temp1 = cos(deg2rad($lat1));
$temp2 = cos(deg2rad($lat2));

$dist = sqrt( $temp1 * $temp2 * pow($lon1 - $lon2 , 2) + pow($lat1 - $lat2, 2) );
$miles = $dist * $deg2mile;

if ($lat2 == $lat1){
if ($lon2 == $lon1)
$dirstr="";
else {
if($lon2 > $lon1)
$dirstr = "East";
else
$dirstr = "West";
}
}else if($lat2 < $lat1){
if($lon2 == $lon1)
$dirstr="North";
else {
if($lon2 > $lon1)
$dirstr="NorthEast";
else
$dirstr="NorthWest";
}
}else if ($lat2 > $lat1){
if($lon2 == $lon1)
$dirstr="South";
else {
if($lon2 > $lon1)
$dirstr="SouthEast";
else $dirstr="SouthWest";
}
}

$miles = sprintf("%0.2f miles %s",$miles,$dirstr);
return $miles;
}



decoct -- Decimal to octal
Categories : PHP, PHP Functions, Math.
Arbitrary Precision Math using BCMATH routines
Categories : PHP, Math., BC math
PHP Utilities - correct grammar helpers: the plural, to be and to have
Categories : PHP, Utilities, Beginner Guides
Calculator for Baroque Violin strings
Categories : Math., PHP, Strings
Contents Page - a script to build contents pages.
Categories : Complete Programs, PHP, Utilities, Filesystem
How to judge if an integer is odd or is even in Php3?
Categories : Math., PHP, Algorithms
Greatest Common Denominator - A simple class that finds the greatest common denominator for two integers.
Categories : PHP, PHP Classes, Math.
3dLib - a class for drawing in 3D space. Supported functions: Line, SetPixel, Polygon, FilledPolygon, etc. 3dChart() function has been added for one-call drawing of 3d charts. Support of mostly used 3d-transformations.
Categories : Graphics, Math., PHP Classes, PHP, Charts and Graphs
mediaCat-GTK v2.0.0 - an mp3/cd/dvd cataloging utility written in php-gtk which interfaces with mysql and ms access (or db supported by PHP's Unified ODBC Functions)
Categories : PHP, MySQL, MS Access, Utilities, Databases
Quote For the Day
Categories : PHP, Utilities, Filesystem
Math operations on big numbers
Categories : PHP, Math.
Library of math functions to expand the functionality of PHP3. Version 1.2.1 fixes a major problem with the gcd function.
Categories : Algorithms, PHP, Math.
Prime number finder (Sieve of Erastothenes)
Categories : PHP, Algorithms, Math.
Diffusion-Limited Aggregation visualization
Categories : PHP, Graphics, Algorithms, Math.
Kasskooye($path) tell you the complete size of a folder
Categories : PHP, Algorithms, Utilities, Filesystem