04-15-2008, 06:09 PM
|
#2 (permalink)
|
|
The Acquainted
Join Date: Nov 2007
Posts: 166
Thanks: 0
|
PHP Code:
<?php // Charge for an item. $nCharge = 100.00 ; // Define the function. function salestax($nCharge, $nShip = .10) { $nYourtotal = ($nCharge + ($nCharge * $nShip)); return $nYourtotal ; }
// Invoke the function... $nYourtotal = salestax($nCharge) ;
// Print the results... print $nYourtotal ;
?>
You are returning the variable correctly. All you needed to do was assign the variable when you call the function. It was returning the value but it wasn't being stored or used in anyway.
__________________
Eric
|
|
|
|