I have an array, and I don’t know how may elements there are in the array. It could be 1, it could be 500, but I need the maximum amount to elements to be 21.
I know I can check the length using count(), but how do I chop the rest off if it is too long? Thanks.
You can use
SplFixedArrayit a good way to manage fixed size array …..Example
See PHP Documentation