#4875 [Opn->Csd]: array_merge() is unable to merge arrays with numeric keys

From: Date: Sat, 04 Jan 2003 17:19:53 +0000
Subject: #4875 [Opn->Csd]: array_merge() is unable to merge arrays with numeric keys
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-29052@lists.php.net to get a copy of this message
ID: 4875 Updated by: andrey@php.net Reported By: waldschrott@kiffen.de -Status: Open +Status: Closed Bug Type: Feature/Change Request Operating System: all PHP Version: 4.0.0 Release New Comment: Please try using this CVS snapshot: http://snaps.php.net/php4-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-latest.zip Seems that F/CR is old. The docs read : If you want to completely preserve the arrays and just want to append them to each other, use the + operator: $array1 = array(); $array2 = array(1 => "data"); $result = $array1 + $array2; So I think to close this. Thank you for your report. Previous Comments: ------------------------------------------------------------------------ [2000-06-07 19:29:59] waldschrott@kiffen.de array_merge() is unable to merge arrays with numeric keys (as described in the documentation), however that´s usefull sometimes and should be possible, in face of the fact that even casting the keys to (string) they´re saved as (int)s. workaround: to merge arrays with numeric keys you can save all keys with a string prefix 'a'.$int for example, after extracting the key do a substr($key,1) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=4875&edit=1

« previous php.bugs (#29052) next »