Re: Arrays past to functions

From: Date: Tue, 31 Jul 2007 09:44:29 +0000
Subject: Re: Arrays past to functions
Groups: php.windows 
Request: Send a blank email to php-windows+get-28289@lists.php.net to get a copy of this message
Wat is the problem with this code. ----- Original Message ---- From: Abhisek Dutta <abhisek.dutt@gmail.com> To: php-windows@lists.php..net Sent: Tuesday, 31 July, 2007 3:07:06 PM Subject: Re: [PHP-WIN] 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

« previous php.windows (#28289) next »