Array's and Rand


#1

So I just finished the last portion of this course and I know that it said to put,

Arrays are zero-indexed, meaning that the first element is at position 0 (zero) and the last element is at
count($array) - 1

I'm having trouble understanding why count($array) - 1 is used as the max value here.


#2

lets say you array has 5 items (just an example), then the items are indexed at 0, 1, 2, 3 and 4, make sense right? But the length is 5, but there is no item at index 5, which is why you subtract one.