I wrote this small PHP class a while ago for a project that never really came about. The purpose is to use GPS coordinates to find the surface distance. I did some research and am pretty sure the formula is correct. Before using it in any mission-critical apps, I suggest verifying the formula. Use it, steal it, whatever, just let me know if you use it in something cool!
As always, I am open to any suggestions that might make it better!