View Single Post
Old 04-15-2008, 06:09 PM   #2 (permalink)
wGEric
The Acquainted
 
wGEric's Avatar
 
Join Date: Nov 2007
Posts: 166
Thanks: 0
wGEric is on a distinguished road
Default

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
wGEric is offline  
Reply With Quote
The Following User Says Thank You to wGEric For This Useful Post:
Dave (04-15-2008)