Re: [PHP] Add associative element to an an array

2002-03-07 Thread Erik Price
On Thursday, March 7, 2002, at 05:50 PM, Bradley Goldsmith wrote: > Ive got an array of associations like this: > > [1]=>2 [2]=>3 [3]=>4 etc > > I want to add a new element [8]=>6. > > How do I do this? I have tried several ways: pushing the element, > merging arrays, et

Re: [PHP] Add associative element to an an array

2002-03-07 Thread Mark
it sounds like you want: $array[8]=6; On Fri, 8 Mar 2002 09:50:24 +1100, Bradley Goldsmith wrote: >Hi, > >Ive got an array of associations like this: > >[1]=>2 [2]=>3 [3]=>4 etc > >I want to add a new element [8]=>6. > >How do I do this? I have tried several ways: pushing the elem

RE: [PHP] Add associative element to an an array

2002-03-07 Thread Bradley Goldsmith
I'll answer my own question. $keyarray[$item[0]] = $node; *duh* How embarrasing is it that this thread will end up on google :) -bcg -Original Message- From: Bradley Goldsmith [mailto:[EMAIL PROTECTED]] Sent: Friday, 8 March 2002 9:50 AM To: [EMAIL PROTECTED] Subject: [PHP] Add asso

Re: [PHP] Add associative element to an an array

2002-03-07 Thread Matt Drake
I'd think $arr['8'] = 6 would work... Using a number (as in $arr[8] = 6) would possibly confuse things, though I can't get to a PHP machine right now so I'm not sure. M On Fri, 8 Mar 2002, Bradley Goldsmith wrote: > Hi, > > Ive got an array of associations like this: > > [1]=>2 [2]