logo CodeStepByStep logo

circle_area

Language/Type: PHP parameters return

Write a function named circle_area that accepts the radius of a circle as a parameter (as a Float) and returns the area of a circle with that radius.

For example, the call of area(2.0) should return 12.566370614359172. You may assume that the radius passed is a non-negative number.

Hint: You can use the standard pi() function in PHP to get an approximate float value for Pi.

Function: Write a PHP function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.