To find the area of a regular polygon inscribed in a circle, we need to know the radius of the circle (which is also the distance from the center of the circle to any vertex of the polygon) and the number of sides of the polygon. Here's a PHP function that calculates the area of a regular polygon inscribed in a circle:
main.php473 chars14 lines
To use the function, simply pass in the number of sides and the radius of the circle:
main.php86 chars3 lines
This would output:
main.php44 chars2 lines
gistlibby LogSnag