Jason Reposa

« Back to posts
  • Viewed
    times
January 19, 2012

PHP: Preserve Keys in array_splice

  • Edit
  • Delete
  • Tags
  • Autopost

array_splice is a wonderful little function. Unfortunately it doesn't preserve the keys if they're numeric. I've tried many combinations of array_shift, array_slice and even array_reverse and array_pop. Here's my solution that preserves numeric keys.

Tweet
  • 0 responses
  • Like
  • Comment