Re: Arrays past to functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Wat is the problem with this code.
 


----- Original Message ----
From: Abhisek Dutta <abhisek.dutt@xxxxxxxxx>
To: php-windows@xxxxxxxxxxxxx
Sent: Tuesday, 31 July, 2007 3:07:06 PM
Subject: Re:  Arrays past to functions

Here's what i made:
<?
$taxrate=array('CA'=>5,'WA'=>7,'OR'=>8);
$states=array('CA','WA','OR');
function calctax($amount, $st)
{
global $taxrate;
global $states;
$tax=$amount*$taxrate[$st];
return $tax/100;
}
$amnt=200;
foreach($states as $st)
{
print "Tax in $st for amount $amnt is ".calctax($amnt, $st);
print "<br/>\n";
}
?>
Output:
Tax in CA for amount 200 is 10
Tax in WA for amount 200 is 14
Tax in OR for amount 200 is 16/
/

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php








      Bollywood, fun, friendship, sports and more. You name it, we have it on http://in.groups.yahoo.com  

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux