Re: Add associative element to an an array
| From: | Mark | Date: | Thu, 07 Mar 2002 22:59:34 +0000 |
| Subject: | Re: Add associative element to an an array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-87704@lists.php.net to get a copy of this message | ||
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
element,
>merging arrays, etc with no luck (it either increments the key or
>doesn't
>work at all).
>
> Any ideas would be appreciated!
>
>Cheers,
>Brad
>