Re: Arrays past to functions

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

 



Hi Jacob

Sorry, my fault entirely. I wrote it in a hurry after copy/pasting your
example. I didn't change the variable names properly or test it.

I still haven't been able to test, but this should work better now.

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


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

  Powered by Linux