[PHP] array merge problem

2005-09-01 Thread Ahmed Abdel-Aliem
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

-- 
Ahmed Abdel-Aliem
Web Developer
www.SafariStudio.net
+20101108551
registered Linux user number 382789

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] array merge problem

2005-09-01 Thread Shaw, Chris - Accenture

manual snippets
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;
?

The numeric key will be preserved and thus the association remains.

Array
(
[1] = data
)
/manual snippets

Its actually on the same page as array_merge in array functions.

-Original Message-
From: Ahmed Abdel-Aliem [mailto:[EMAIL PROTECTED]
Sent: 01 September 2005 09:43
To: php-general@lists.php.net
Subject: [PHP] array merge problem


*

This e-mail has been received by the Revenue Internet e-mail service.

*

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

--

Ahmed Abdel-Aliem
Web Developer
www.SafariStudio.net
+20101108551
registered Linux user number 382789

--

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php







This message has been delivered to the Internet by the Revenue Internet e-mail 
service

*

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php