Created
September 9, 2020 09:56
-
-
Save luckyshot/9fe1be5a5332f8fa02abdaf8eda65bd8 to your computer and use it in GitHub Desktop.
PHP distance between two points (flat coordinates 2 XY axis)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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