note 36361 added to function.array-push
| From: | stuart at rn2 dot php dot net | Date: | Tue, 07 Oct 2003 11:48:49 +0000 |
| Subject: | note 36361 added to function.array-push | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-57961@lists.php.net to get a copy of this message | ||
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"));
----
Manual Page -- http://www.php.net/manual/en/function.array-push.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+36361
Delete -- http://master.php.net/manage/user-notes.php?action=delete+36361&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+36361&report=yes
Search -- http://master.php.net/manage/user-notes.php