RE: [PHP-WIN] Arrays past to functions
| From: | Jacob Bergman | Date: | Fri, 27 Jul 2007 17:35:29 +0000 |
| Subject: | RE: [PHP-WIN] Arrays past to functions | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-28266@lists.php.net to get a copy of this message | ||
I tried using that, but all I get is these errors:
Notice: Undefined variable: amount in C:\xampp\htdocs\test3.php on line
16
Fatal error: Function name must be a string in C:\xampp\htdocs\test3.php
on line 11
Jacob Bergman
Network Technician
Pullman School District #267
(509) 432-4012
jbergman@psd267.wednet.edu
-----Original Message-----
From: Niel Archer [mailto:spam-free@blueyonder.co.uk]
Sent: Friday, July 27, 2007 9:59 AM
To: php-windows@lists.php.net
Subject: Re: [PHP-WIN] Arrays past to functions
Hi Jacob
try this:
function compute_salestax ($Amount , $State)
{
$taxRate = array("CA" => 5 , "WA" => 7, "OR" => 8);
return $Amount * $taxRate($state);
}
$payment = 1500;
$locale = 'CA';
print "Tax on $amount in $locale is " . compute_salestax ($payment ,
$locale);
--
Niel Archer
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php