[PHP-WIN] Arrays

2008-09-16 Thread Varuna Seneviratna
Create two arrays of numbers and add the values in each array, to each corresponding value by index number in the other array ? Is their a function that can do this? Varuna -- Varuna Seneviratna No 514 Udumulla Road Battaramulla Sri Lanka Tel : 011-2888620 Mobile:0715617141

Re: [PHP-WIN] Arrays past to functions

2007-07-31 Thread vikas batra
Wat is the problem with this code. - Original Message From: Abhisek Dutta <[EMAIL PROTECTED]> 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: 5,'WA'=>7,'OR'

Re: [PHP-WIN] Arrays past to functions

2007-07-31 Thread Abhisek Dutta
Here's what i made: 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 "\n"; } ?>

RE: [PHP-WIN] Arrays past to functions

2007-07-28 Thread Jeff White
Tax = 120.00 in OR. I hope this helps!! Jeff White -Original Message- From: Jacob Bergman [mailto:[EMAIL PROTECTED] Sent: Friday, July 27, 2007 2:07 PM To: php-windows@lists.php.net Subject: RE: [PHP-WIN] Arrays past to functions Thanks a bunch guys, I'm out for the day, I wi

Re: [PHP-WIN] Arrays past to functions

2007-07-27 Thread M. Sokolewicz
Niel Archer wrote: 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.

Re: [PHP-WIN] Arrays past to functions

2007-07-27 Thread Niel Archer
> I must say, you're the first (and only) person I've ever seen using > foreach(): endforeach in PHP. As far as I know, most people use > curly-bracers (in this case), I'm sure most people wouldn't even know > this was possible (I had to look it up in the manual, and it's only in a > single not

Re: [PHP-WIN] Arrays past to functions

2007-07-27 Thread Niel Archer
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 y

Re: [PHP-WIN] Arrays past to functions

2007-07-27 Thread M. Sokolewicz
Niel Archer wrote: Hi Jacob. Spotted another problem. function compute_salestax ($Amount , $State) { $taxRate = array("CA" => 5 , "WA" => 7, "OR" => 8); return $Amount / 100 * $taxRate($State); } $payment = 1500; $locale = 'CA'; print "Tax on $amount in $locale is " . compute_salesta

Re: [PHP-WIN] Arrays past to functions

2007-07-27 Thread Niel Archer
Hi Jacob. Spotted another problem. function compute_salestax ($Amount , $State) { $taxRate = array("CA" => 5 , "WA" => 7, "OR" => 8); return $Amount / 100 * $taxRate($State); } $payment = 1500; $locale = 'CA'; print "Tax on $amount in $locale is " . compute_salestax ($payment , $locale

RE: [PHP-WIN] Arrays past to functions

2007-07-27 Thread Jacob Bergman
2007 11:03 AM To: php-windows@lists.php.net Subject: Re: [PHP-WIN] Arrays past to functions 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 sho

Re: [PHP-WIN] Arrays past to functions

2007-07-27 Thread Niel Archer
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 , "W

Re: [PHP-WIN] Arrays past to functions

2007-07-27 Thread M. Sokolewicz
- Thanks for the help guys! Jacob Bergman Network Technician Pullman School District #267 (509) 432-4012 [EMAIL PROTECTED] -Original Message- From: M. Sokolewicz [mailto:[EMAIL PROTECTED] Sent: Friday, July 27, 2007 9:3

RE: [PHP-WIN] Arrays past to functions

2007-07-27 Thread Jacob Bergman
PROTECTED] -Original Message- From: Niel Archer [mailto:[EMAIL PROTECTED] 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&

RE: [PHP-WIN] Arrays past to functions

2007-07-27 Thread Jacob Bergman
- Thanks for the help guys! Jacob Bergman Network Technician Pullman School District #267 (509) 432-4012 [EMAIL PROTECTED] -Original Message- From: M. Sokolewicz [mailto:[EMAIL PROTECTED] Sent: Friday, July 27, 2007 9:34 AM To: Ja

Re: [PHP-WIN] Arrays past to functions

2007-07-27 Thread Niel Archer
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); --

Re: [PHP-WIN] Arrays past to functions

2007-07-27 Thread M. Sokolewicz
ction and pass it a state and amount for each state. Thanks for the reply. Jacob Bergman Network Technician Pullman School District #267 (509) 432-4012 [EMAIL PROTECTED] -Original Message- From: Jarrett Meyer [mailto:[EMAIL PROTECTED] Sent: Friday, July 27, 2007 8:56 AM To: PHP Windows Li

RE: [PHP-WIN] Arrays past to functions

2007-07-27 Thread Jacob Bergman
TED] Sent: Friday, July 27, 2007 8:56 AM To: PHP Windows List Subject: Re: [PHP-WIN] Arrays past to functions You don't really need an array here. function ComputeSalesTax($Amt, $State) { switch ($State) { case "CA": $tax = 1.05;

Re: [PHP-WIN] Arrays past to functions

2007-07-27 Thread Jarrett Meyer
"LA"); // fails -- Jarrett M. T. Meyer http://jarrettmeyer.blogspot.com http://www.jarrettmeyer.com - Original Message From: Jacob Bergman <[EMAIL PROTECTED]> To: php-windows@lists.php.net Sent: Friday, July 27, 2007 11:46:19 AM Subject: [PHP-WIN] Arrays past to functions Hello all, I am

[PHP-WIN] Arrays past to functions

2007-07-27 Thread Jacob Bergman
Hello all, I am learning about passing arrays to functions, and am trying to create a function that will display a total amount for a price for several states. Say using CA, WA, and OR, and setting there tax rates at, whatever, say 5%, 7%, and 8% respectively. I want a function I can pass the a

[PHP-WIN] Arrays

2004-04-12 Thread Daniel Anderson
Hi, can anyone walk me through arrays please. I am new to PHP and arrays appear to come in many forms and I need help getting arrays working properly. Anything will be a great help, thanks, Dan

Re: [PHP-WIN] arrays and nested arrays and loops and databases...

2003-01-20 Thread Dash McElroy
data. > but the address bar should not be hold if a large number of address > presents. > Is that have any suggestions?? > Thanks yours > > tarn@hk > > - Original Message - > From: "Dash McElroy" <[EMAIL PROTECTED]> > To: "H Marc Bower"

Re: [PHP-WIN] arrays and nested arrays and loops and databases...

2003-01-20 Thread H Marc Bower
This worked wonderfully. Thanks, Dash. - Original Message - From: "Dash McElroy" <[EMAIL PROTECTED]> Subject: Re: [PHP-WIN] arrays and nested arrays and loops and databases... > If I understand correctly, you want to have an array containing an array > with peop

Re: [PHP-WIN] arrays and nested arrays and loops and databases...

2003-01-19 Thread Eric
rn@hk - Original Message - From: "Dash McElroy" <[EMAIL PROTECTED]> To: "H Marc Bower" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Sunday, January 19, 2003 11:33 AM Subject: Re: [PHP-WIN] arrays and nested arrays and loops and databases... > If I u

Re: [PHP-WIN] arrays and nested arrays and loops and databases...

2003-01-18 Thread Dash McElroy
If I understand correctly, you want to have an array containing an array with people's email address and name from your db like this: $to[0]['address'] = [EMAIL PROTECTED] $to[0]['name'] = Bob Smith $to[1]['address'] = [EMAIL PROTECTED] $to[1]['name'] = John Jones (the above is obviously not vali

[PHP-WIN] arrays and nested arrays and loops and databases...

2003-01-18 Thread H Marc Bower
Well... I can usually puzzle myself through these things, but I figured it's time to ask the list. :) It may be a simple thing that I'm missing, but here's what I have. The structure that I'm trying to modify is as follows: $to = array( array(

Re: [PHP-WIN] Arrays - I may have gone blind

2002-12-16 Thread Cam Dunstan
with a SELECT astatement then applying a second SELECT to that table??? - Original Message - From: "Aidal" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, December 16, 2002 10:59 PM Subject: [PHP-WIN] Arrays - I may have gone blind > Hi NG. >

[PHP-WIN] Arrays - I may have gone blind

2002-12-16 Thread Aidal
Hi NG. I'm sure there is somthing implemented in PHP to do this but I just cant see it. I want to run through an array and remove some entries where is true and is lower than the other entries of First i thought... hmm this sounds like a linked list, I'm gonna make one. But I cant seem to mak