Passing by reference...
| From: | Anthony Ritter | Date: | Tue, 01 Jan 2002 01:37:19 +0000 |
| Subject: | Passing by reference... | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-11242@lists.php.net to get a copy of this message | ||
I'm using Windows98 / Apache and looking at a php snippet from Wrox on page
204.
It goes like this:
..................................
<?
function tax (&$Salary)
{
$Salary= $Salary - (($Salary/100)*20);
return $Salary;
}
$Salary=2500;
echo $Salary;
?>
......................................
The result in the textbook is 2000 but I'm getting 2500.
It says that to pass an argument by reference you *add* an ampersand to the
front variable that you are passing.
Any help would be appreciated.
Happy new year to all,
Tony Ritter