To find the surface area of a cone in PHP, you can use the mathematical formula:
surface area = pi * r * (r + sqrt(h^2 + r^2))
where r
is the radius of the base of the cone and h
is the height of the cone.
Here's the PHP function that calculates the surface area of a cone:
main.php161 chars5 lines
To use the function, simply pass in the radius and height of the cone as arguments:
main.php140 chars7 lines
This will output:
main.php49 chars2 lines
gistlibby LogSnag