ID: 42323 Updated by: [EMAIL PROTECTED] Reported By: kev at projectcolo dot org dot uk -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: N/A PHP Version: Irrelevant New Comment:
This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. "If you want to completely preserve the arrays and just want to append them to each other (not overwriting the previous keys), use the + operator" Previous Comments: ------------------------------------------------------------------------ [2007-08-16 22:36:17] kev at projectcolo dot org dot uk Description: ------------ The notes in Example 257 above are incorrect. It states: If you want to completely preserve the arrays and just want to append them to each other, use the + operator Check the array type page at http://www.php.net/manual/en/language.types.array.php which states differently. Duplicate keys are ignored with the + operator. Reproduce code: --------------- <?php $x = array('moon','sky'); $y = array('rain','shine'); var_dump($x + $y); var_dump(array_merge($x, $y)); ?> Expected result: ---------------- array(2) { [0]=> string(4) "moon" [1]=> string(3) "sky" ... more values } array(4) { [0]=> string(4) "moon" [1]=> string(3) "sky" [2]=> string(4) "rain" [3]=> string(5) "shine" } Actual result: -------------- array(2) { [0]=> string(4) "moon" [1]=> string(3) "sky" } array(4) { [0]=> string(4) "moon" [1]=> string(3) "sky" [2]=> string(4) "rain" [3]=> string(5) "shine" } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=42323&edit=1
