Re: Add associative element to an an array

From: Date: Thu, 07 Mar 2002 23:02:15 +0000
Subject: Re: Add associative element to an an array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-87705@lists.php.net to get a copy of this message
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, etc with no luck (it either increments the key or doesn't work at all).
Have you tried just directly setting this array element? You don't say what your array is named, so I'll call it $array. $array[8] = 6; Is that what you are talking about? Erik ---- Erik Price Web Developer Temp Media Lab, H.H. Brown pricee@hhbrown.com

« previous php.general (#87705) next »