Re: [PHP] Simple array problem

2008-07-01 Thread tedd
At 3:44 PM +0100 7/1/08, Richard Heyes wrote: You missed it a second time? :-) My sight is awful - if you don't point it out, chances are I won't see it. -- Richard Heyes I'm just as bad, I only saw the error after I tried to get your code to run. I thought I had another way, but your's w

Re: [PHP] Simple array problem

2008-07-01 Thread Richard Heyes
You missed it a second time? :-) My sight is awful - if you don't point it out, chances are I won't see it. -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Simple array problem

2008-07-01 Thread Jim Lucas
Roberto Costumero Moreno wrote: I think the problem is easier... and also the solutions doing a "for" instead of "foreach" are not good solutions because if the array is not index-consecutive the loop fails. So, if you has an array with the colors as indexes and the integer value X as the value

Re: [PHP] Simple array problem

2008-07-01 Thread tedd
At 1:50 PM +0100 7/1/08, Richard Heyes wrote: Small correction: Which is...? -- Richard Heyes You missed it a second time? :-) It's not, new_array[], but new_value[]. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing Li

Re: [PHP] Simple array problem

2008-07-01 Thread Roberto Costumero Moreno
I think the problem is easier... and also the solutions doing a "for" instead of "foreach" are not good solutions because if the array is not index-consecutive the loop fails. So, if you has an array with the colors as indexes and the integer value X as the value for that position of the array, up

Re: [PHP] Simple array problem

2008-07-01 Thread Wolf
Brian Dunning wrote: I'm trying to add a number to a value in an array. Pretend I have this: $new_value = array('orange', 2); $arr = array( array('blue', 4), array('orange', 5), array('green', 6)); I want to add the new value to the existing matching array element, so I end up with

Re: [PHP] Simple array problem

2008-07-01 Thread Eric Butera
On Tue, Jul 1, 2008 at 8:50 AM, Richard Heyes <[EMAIL PROTECTED]> wrote: >> Small correction: > > Which is...? > > -- > Richard Heyes > > Employ me: > http://www.phpguru.org/cv > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Look at

Re: [PHP] Simple array problem

2008-07-01 Thread Richard Heyes
Small correction: Which is...? -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Simple array problem

2008-07-01 Thread tedd
At 9:35 AM +0100 7/1/08, Richard Heyes wrote: Brian Dunning wrote: Seems like it should be really simple but all the ways I can figure out to do it are too kludgey. It's rather easy: for ($i=0; $i Small correction: for ($i=0; $ihttp://www.webbytedd.com/b1/array/ But, I'm not sure as to why

Re: [PHP] Simple array problem

2008-07-01 Thread Richard Heyes
Brian Dunning wrote: I'm trying to add a number to a value in an array. Pretend I have this: $new_value = array('orange', 2); $arr = array( array('blue', 4), array('orange', 5), array('green', 6)); I want to add the new value to the existing matching array element, so I end up with

Re: [PHP] Simple array problem

2008-07-01 Thread Thijs Lensselink
Quoting Brian Dunning <[EMAIL PROTECTED]>: I'm trying to add a number to a value in an array. Pretend I have this: $new_value = array('orange', 2); $arr = array( array('blue', 4), array('orange', 5), array('green', 6)); I want to add the new value to the existing matchi

[PHP] Simple array problem

2008-06-30 Thread Brian Dunning
I'm trying to add a number to a value in an array. Pretend I have this: $new_value = array('orange', 2); $arr = array( array('blue', 4), array('orange', 5), array('green', 6)); I want to add the new value to the existing matching array element, so I end up with this: