Calculating the area of a circle using php function
<p>I need to create a function to calculae the area of a circle. The function should take in two arguments (a number and a string). The number should be the radius or diameter of the circle. The string should be the word "diameter". The function should return the area of the circle or a -1 for an error. Finally, the script should initialize test variables, call the function and display the results as a web page. </p>

<p>This is beginning PHP but I'm just having problems catching on. Thanks!</p>

<p>This is what I have so far but it doesn't return the -1 and I can't figure out how to do that. </p>

<pre><code>$diameter = 4.0;
$pi = 3.14;
$title="Circle";

echo "&lt;html&gt; &lt;head&gt; &lt;title&gt; $title &lt;/title&gt; &lt;/head&gt; &lt;body&gt;";

function circleArea($diameter, $pi) 
{
    $area = $diameter * $pi; 
    return $area; 
} 

echo circleArea ($diameter,$pi); 
echo "&lt;/body&gt; &lt;/html&gt;";
</code></pre>
