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