How to get the last n items in a PHP array as another array?

$n is equal to the number of items you want off the end.

$arr = array_slice($old_arr, -$n);

Leave a Comment