array_push() an associative array item
| From: | Peter Lockhart | Date: | Mon, 14 Aug 2000 10:08:51 +0000 |
| Subject: | array_push() an associative array item | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-11577@lists.php.net to get a copy of this message | ||
Is it possible to use array_push() (or anything) to append an associative
array item to an existing array ??
ie I need to append "$key"=>"$val" onto an array, so that i can then access
$array($key); and get the associative $val value.
I have tried a few combinations to get this to work with no luck.
none of the following work:
array_push ($array, array($key, $value));
array_push ($array, "\"$key\" => \"$value\"");
array_push ($array, "$key => $val");
etc etc.
How can this get done ?
Peter Lockhart
Key Web Hosting
http://www.key.co.za