After each() has executed, the array cursor will be left on the next element of the array, or past the last element if it hits the end of the array. You have to use ...
php.net