好的,我有一组特定坐标的目标,以及一些其他坐标上的人员,我想要检查这些人员的坐标是否距离目标坐标在2公里(2000米)以内。
下面的代码只是为了更清楚地说明我的需求,问题当然是如何实现这个功能?我非常感谢能够提供解决方案,谢谢!
$person0 = Array('56.34342', '49.324523');
$person1 = Array('57.49544', '47.421524');
$person2 = Array('56.74612', '48.722323');
$target = Array('56.35343', '49.342343');
for (var $i = 0; $i < 4; i$++) {
CheckIfMatch($person + i$);
}
function CheckIfMatch($person) {
if($person is within 2km from target) {
echo 'Match!';
}
}