|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-08-29 17:35 UTC] vrana@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 20 00:00:02 2025 UTC |
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 )