View Single Post
Old 04-15-2008, 06:12 PM   #3 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

The only segment that I have modified is assigned the value of the salestax function to the $nYourtotal variable. When you issue the return in your custom function, that simply returns data back, and so you can either assign (as in our case), print (as we do later on when we print), or do nothing with (as you were doing previously).

php Code:
// 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 ;
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
The Following User Says Thank You to Wildhoney For This Useful Post:
Dave (04-15-2008)