Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PHP distance between two points (flat coordinates 2 XY axis)
<?php
function distance($x1, $y1, $x2, $y2){
return sqrt(
pow(abs($x1 - $x2), 2)
+
pow(abs($y1 - $y2), 2)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment