note 36361 deleted from function.array-push by didou
| From: | didou@php.net | Date: | Tue, 07 Oct 2003 11:59:06 +0000 |
| Subject: | note 36361 deleted from function.array-push by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57962@lists.php.net to get a copy of this message | ||
Note Submitter: stuart
----
As you probably know by now, array_push will not work correctly with associative arrays. A very
simple way to add new items to an existing associative array is like this:
-The Existing Array-
$myarray = array("myvar"=>"myval",
"othervar"=>"otherval");
- Adding to the above array -
$myarray = array_merge($myarray, array("newvar"=>"newval"));