Does PHP have some kind of function that will compare the numbers? I know they have text comparison like similar_text() But say I want to compare lat/lng values, and they’re very similar but very slight difference
example :
place 1
lat: 34.095161
lng: -117.720638
compare with
lat: 34.0948841
lng: -117.7206854
place 2
lat: 34.094572563643
lng: -117.72184828904
compare with
lat: 34.094112
lng: -117.7250746
They maybe very close to each other which I want to be able to get a certain range? Is there some PHP function I can use?
Thanks
I don’t think there’s a built in function. Maybe you could use an Euclidian distance to compute their similarity is an easy-to-implement way.
NB : $diff is here a pure quantification of difference, you cannot consider lat/lng values as forming 2D points whose distance can be compute through Euclidian approach stricto sensu (see here why)