Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

Remove all but last 10 elements in an array

$
0
0

I'm looking for a way to remove all but the last 10 elements in an array. Is it possible to do this with array_splice? I have an array with greater than 1000 elements and I don't want to have to specify each element I want to remove. It would be cool if I could do something like "remove elements 1-990".


Viewing all articles
Browse latest Browse all 13200

Trending Articles