PHP Class
Taught by Dedicated Nerad Tendo

Welcome to PHP class - an Out of Character class where you will learn the basics of PHP code. If you have any questions or comments, please feel free to e-mail the instructor.

Return to Messages | Post Reply
Currently browsing thread: Lesson 7: Functions
Still Error'd
Nerad Tendo
email
Posted on:
Jul 20, 2009 19:17:36
Ryaol Admestiainu said:
function Conversion($temp)
{
GLOBAL $system; // either be F for Fahrenheit or C for Celsius

if($system == "F")
{
$answer = (($temp-32)*5)/9;
echo $answer;
}
elseif($system == "C")
{
$answer = (($temp*9)/5)+32;
echo $answer;
}
else
{
echo "You must use either a 'C' or and 'F'";
}
}

$system = 'F';
echo Conversion(32)."
";
echo Conversion(212)."
";
$system = 'C';
echo Conversion(0)."
";
echo Conversion(100)."
";

// Going to go out on a limb on this one :P
function Rec($width; $Height)***Parse Error: unexpected ';' *** // That should fix the errors.
{
if($width == 0 || $width == "")
{
$width = 5;
}
elseif($Height == 0 || $Height == "")
{
$Height = 5;
}

return $width * $Height;
}



$width1 = 10;
$Height1 = 5;
$width2 = 8;
$Height2 = 4;

$surfSide = Rec($width1; $Height1)*2;***Parse Error: unexpected ';' ***
$surfTops = Rec($width2; $Height2)*2;***Parse Error: unexpected ';' ***

echo $surfSide + $surfTops;
 

Replies...

  • Re: Still Error'd (1)
All times listed in GMT 1 (DLS) / EST

Post Reply

 

Based on an Orca Script.