I would like to set a limit to my array. If my array has 100 items I want it to print only the first 10.
Printable View
I would like to set a limit to my array. If my array has 100 items I want it to print only the first 10.
What code to you already have? Have a look at the array_slice function.
If you are using a foreach() loop then just have it stop at 10. Perhaps you could give a little more information if this wasn't helpful.