Hi all, Adding these two array functions has been on the TODO for a while, and my original patch has been collecting dust for almost 2 years. :-) I just updated the patches now after some small changes (the original version for 5.2 is currently linked on the wiki). A brief description, if I remember correctly, especially the recursive version (Lukas can maybe give more info. since he created the original implementation in PHP ;-)):
array_replace() is like the + operator applied to arrays, except that it WILL overwrite ("replace") existing entries. array_replace_recursive() will do the same except that it becomes recursive only when both the destination and source entries are arrays, otherwise the new source entry still replaces any existing one. In the wrapper function, I removed the SEPARATE_ZVAL() and convert_to_array_ex() as they appear to be leftover from PHP 4 (before array_merge[_recursive] checked if the args were arrays first). This made a big performance difference when I benchmarked 2 years ago! I also updated it to use array_init_size() (returned array will have at least as many elements as the largest input array) for another small optimization. http://realplain.com/php/array_replace.diff http://realplain.com/php/array_replace_5_3.diff (With NEWS entry) http://realplain.com/php/array_replace.phpt (Still has the old UEXPECT section for HEAD; will fix if I commit) Any thoughts or objections? Should I commit before Thursday, like tomorrow...? Thanks, Matt -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php