What is the best way to accomplish this?
+1
A:
In the current order? I'd say array_slice(). Since it's a built in function it will be faster than looping through the array while keeping track of an incrementing index until N.
Fanis
2010-09-15 17:25:12
+1
A:
You can use array_slice as:
$sliced_array = array_slice($array,0,$N);
codaddict
2010-09-15 17:25:31