Unset Array Items

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thiscatis
Forum Contributor
Posts: 434
Joined: Thu Jul 20, 2006 11:00 am

Unset Array Items

Post by thiscatis »

Hi guys!

Well I'm having some coding problems here.

I can unset a specific array item using

Code: Select all

unset ($files['0']);
But is there a way to unset specific files for e.g. unset all items from the array except the first 20 items.
With 20 being a variable.


Thanks!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

array_slice() may be of interest.
Post Reply