Use array_lengthof to compute the number of iterations of a loop.