note 40205 modified in function.array-merge by vrana
| From: | vrana@php.net | Date: | Tue, 17 Aug 2004 13:58:46 +0000 |
| Subject: | note 40205 modified in function.array-merge by vrana | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-79779@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:
<?php
$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.
--was--
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.
http://php.net/manual/en/function.array-merge.php