You want to only get the first 5 items from an array, but if there only exists less than 5 items in the array, you still want to get them all.
The result would be an array variable containing at most 5 items.
Is there a single PHP function that can do this? (I want to avoid using any loop or if statement)
Many thanks to you all.
The result would be an array variable containing at most 5 items.
Is there a single PHP function that can do this? (I want to avoid using any loop or if statement)
Many thanks to you all.