Two problems exist in holiday3.php. Here's your code:
Quote:
quote:
function Calculator($Price, $CityModifier, $StarModifier)
{
return $Price=$Price*$CityModifier*Starmodifier;
}
|
Both problems are on the same line. The first is that you don't have a dollar sign in front of "Starmodifier" in your return statement, so PHP thinks that you're looking up a defined constant. Since Starmodifier is NOT a named constant, PHP treats it as a string. PHP tries to convert that string to a number because you're using it in a mathematical expression (multiplication). Since the string "Starmodifier" doesn't contain any digits, it gets converted to zero. That's why all your prices are zero.
Second, your variable name is "StarModifier". PHP variable names are case-sensitive, so $StarModifier is __NOT__ the same thing as $Starmodifier.
Here's the fixed code:
function Calculator($Price, $CityModifier, $StarModifier)
{
return $Price * $CityModifier * $StarModifier;
}
Take care,
Nik
http://www.bigaction.org/