Re: array merge problem
| From: | JamesBenson | Date: | Thu, 01 Sep 2005 15:38:59 +0000 |
| Subject: | Re: array merge problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-221692@lists.php.net to get a copy of this message | ||
could this help
If you want to completely preserve the arrays and just want to append them to each other, use the + operator:
<?php
$array1 = array();
$array2 = array(1 => "data");
$result = $array1 + $array2;
?>
http://www.php.net/manual/en/function.array-merge.php
Ahmed Abdel-Aliem wrote:
i have the array with the following structure : Array ([19] => 20.00 [25] => 20.00 [7] => 30.00 [17] => 30.00) when i merge a field to it using array_merge it returns that : Array ([0] => 20.00 [1] => 20.00 [2] => 30.00 [3] => 30.00 [4] => 200.00) how can i merge the field without losing the original keys ? can anyone help me with that plz thanks in advance