从Javascript到PHP代码翻译对我有帮助吗?

时间:2019-06-25 21:58:34

标签: javascript php

您好,以下javascript代码的php等价物是什么?

function arePointsNear(checkPoint, centerPoint, km) {
    var ky = 40000 / 360;
    var kx = Math.cos(Math.PI * centerPoint.lat / 180.0) * ky;
    var dx = Math.abs(centerPoint.lng - checkPoint.lng) * kx;
    var dy = Math.abs(centerPoint.lat - checkPoint.lat) * ky;

    return Math.sqrt(dx * dx + dy * dy) <= km;
}

var vasteras = { lat: 41.235188, lng: 28.495035 };
var stockholm = { lat: 41.09774752058191, lng: 29.080487759810946 };

var n = arePointsNear(vasteras, stockholm, 49);

console.log(n);

1 个答案:

答案 0 :(得分:3)

 Dim sControlName as string
 Dim f as Form
 sControlName = "myControlName"
 Set f = Forms!myFormName.myChildFormName.Form   {or any form }

 f(sControlName).Top = { some value }

 i.e. don't use With f / End With

但是最好使用像https://github.com/mjaschen/phpgeo这样的专门解决方案。