ID: 34227
Updated by: [EMAIL PROTECTED]
Reported By: david dot tulloh at anu dot edu dot au
-Status: Open
+Status: Closed
Bug Type: Documentation problem
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.
"Note that numeric keys in input are not preserved."
Previous Comments:
------------------------------------------------------------------------
[2005-08-24 07:21:41] david dot tulloh at anu dot edu dot au
Description:
------------
The array_splice documentation doesn't warn about the fact that
array_splice will change the keys of the original array. This occurs
whenever the spliced in array and removed array are of a different
size.
For example in the code below you can see that the key for 'f' has been
changed by the array_splice operation.
Reproduce code:
---------------
$a = array('a', 'b', 'c', 'd', 'e', 'f');
Array
(
[0] => a
[1] => b
[2] => c
[3] => d
[4] => e
[5] => f
)
array_splice($a, 2, 2, array('g', 'h', 'i'));
Array
(
[0] => a
[1] => b
[2] => g
[3] => h
[4] => i
[5] => e
[6] => f
)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34227&edit=1