I know I could use array_slice() to create a new array of all but the first & last elements, perform operations on each, and then tack the original first and last values back on. That seems like overkill though. Is there a cleaner way to perform an operation (in this case, just appending and prepending strings to the array values) on all interior array elements and not on the ends?
I know I could use array_slice() to create a new array of all but
Share
I might be missing something, but wouldn’t this do the trick?