note 40205 deleted from function.array-merge by salathe
| From: | salathe@php.net | Date: | Mon, 06 Sep 2021 22:45:10 +0000 |
| Subject: | note 40205 deleted from function.array-merge by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-216895@lists.php.net to get a copy of this message | ||
Note Submitter: frankb at fbis dot net
----
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.