...

View Full Version : get first 5 elements of an array



esthera
08-06-2007, 06:41 AM
I have a array called

$ids[]

how can i set $ids[] = to only the first 5 elements of the array. (the array is really pulled from a post)

mcjwb
08-06-2007, 12:14 PM
You can use the array_slice() function, like so:


$ids = array_slice($ids, 0, 5);



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum