array_splice preserving keys
问题 I faced the situation that splicing arrays with preserved-keys, so I made the following function. I reached the solution that wrapping each items with array, but there seems to be some memory-inefficient statements. Have you any ideas? Thank you. array_splice_pk This preserves keys, differently from array_splice . Overview: &$input -> same as array_splice one. $key -> target key. $use_key_as_offset -> use $key parameter as a numeric offset . $length -> same as array_splice one. $replacement -