RE: [PHP] Add associative element to an an array
| From: | Bradley Goldsmith | Date: | Thu, 07 Mar 2002 22:58:58 +0000 |
| Subject: | RE: [PHP] Add associative element to an an array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-87703@lists.php.net to get a copy of this message | ||
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:brad@massive.com.au]
Sent: Friday, 8 March 2002 9:50 AM
To: php-general@lists.php.net
Subject: [PHP] Add associative element to an an array
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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php