Imaging that I have an array of places, and each item include name, lat and long of that place. Now I want to group nearby items using a radius in miles for example.
How do I achieve this in PHP?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to have a second array to store data. And a duplicate of your array of places.
Vars
I know this is not an efficient algorithm, but it does the job. If you have many data, maybe it is better to use another algorithm.