I'm getting a "Fatal error: Can't use function return value in write context in..." error and I'm not sure why. I'm certain I'm missing some little thing somewhere, but I can't see it. I'm hoping one of you people who always seem to be much brighter than myself can point out what I'm doing wrong.
Here is the function:
Here is the line that calls the function:
The function is supposed to strip off any "$" and then multiply the two numbers together.
Thanks everyone!!
Here is the function:
Code:
//function that clears the "$" sign and gets the cost for the item
function item_cost($cost, $amount)
{
$cost2 = preg_replace("/[^a-zA-Z0-9s.]/", "", $cost); //removes the "$" sign
$cost1 = (float)$cost2; //makes sure the variable is a number
$amount1 = (float)$amount; //makes sure the variable is a number
$x= $cost1 * $amount1; //multiplies the amount ordered by the number ordered
return $x;
}
Here is the line that calls the function:
Code:
$item_price($i)= item_cost($price[$i], $amount_ordered);
The function is supposed to strip off any "$" and then multiply the two numbers together.
Thanks everyone!!