You can learn how to acquire the lat/long at: Get latitude and longitude automatically using php, API
Store the lat/long of each user within their data within your DB.
Additionally, it would be wise to store the COUNTRY of each user - so your query will be reduced. Highly advise to also store regional data such as ZIP/POSTAL to further reduce your query load.
Then on whatever php page you are using, you will already have the regional data (as explained above) of the user you are searching on. With that data loop through all of the other members within the same ZIP/POSTAL region and query their stored lat/long.
Once you have the lat/long of others within the same ZIP/POSTAL region, you can use a function such as: http://snipplr.com/view/2531/
or, you can perform a lot of this via a SQL statement as explained https://stackoverflow.com/a/7672821/797620 but I have never tested that statement myself.
This page at google provides another and very well detailed method that you could give a try: https://developers.google.com/maps/articles/phpsqlsearch_v3