Array_slice()

I have an arrao

$available_rus = range(1,56);

I’m trying to trim off 13 values off the end, do I use array_slice() or rtrim()?

You use array_slice where the offset is 0 and the length is -13.

$all_but_last_thirteen = array_slice($available_rus, 0, -13);

rtrim() is for dealing with strings and not arrays. :slight_smile:

1 Like

or just… don’t make the range start at 1?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.