note 40205 added to function.array-merge
| From: | frankb at fbis dot net | Date: | Wed, 25 Feb 2004 09:02:22 +0000 |
| Subject: | note 40205 added to function.array-merge | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-65698@lists.php.net to get a copy of this message | ||
to merge arrays and preserve the key i found the following working with php 4.3.1:
$array1 = array(1 => "Test1", 2 => "Test2");
$array2 = array(3 => "Test3", 4 => "Test4");
$array1 += $array2;
dont know if this is working with other php versions but it is a simple and fast way to solve that
problem.
----
Manual Page -- http://www.php.net/manual/en/function.array-merge.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40205
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40205&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40205&report=yes
Search -- http://master.php.net/manage/user-notes.php