Hi
> hi Niel,
>
> I believe Jacob wanted to know how he could calculate the tax for _all_
> states passed in as an array in one go. Yours simply gives it for 1
> State ("locale"). Other than thatm $taxRate($state) translates to
> Array($state) which gives an E_FATAL_ERROR obviously. I assume you meant
> to say $taxRate[$State].
After re-reading Jacob's post I have to agree I misunderstand. Here's a
better answer to his request.
// Create array of locales we want tax for
$locales = array("CA", "OR");
$payment = 1500;
ShowSalesTax($payment, $locales);
function ShowSalesTax($Amount , $States)
{
//aray of states and their rates
$StatesRates = array("CA" => 5 , "WA" => 7, "OR" => 8);
foreach($States as $state):
print "Tax on $Amount in $state is " . $payment / 100 *
$StatesRates[$state] . "\n";
endforeach;
}
Obviously, it's only an example and needs refining.
--
Niel Archer
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php