note 38204 deleted from ref.math by pollita
| From: | pollita@php.net | Date: | Thu, 11 Dec 2003 20:06:24 +0000 |
| Subject: | note 38204 deleted from ref.math by pollita | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-61832@lists.php.net to get a copy of this message | ||
Note Submitter: sdpeelejr@net-riches.com
----
Simple Midpoint function for calculating the distance between two points on a coordinate plane
<?php
function midpoint($x1,$x2,$y1,$y2){
$x = $x1 + $x2;
$y = $y1 + $y2;
$xf = $x / 2;
$yf = $y / 2;
echo "The midpoint (x,y) is ($xf,$yf)";
}
midpoint(10,20,2,2); //Returns The midpoint (x,y) is (15,2)
?>
Enjoy!