I went searching for how to calculate the area of a rectangle* on the surface of the earth using PHP and didn’t find one online. Someone probably has one somewhere, but it was just as fast for me to adapt one as it was to continue searching, so here it is. Enjoy.
This code is also available on GitHub if you prefer:
https://github.com/prairiewest/PHPRectangleArea