I think $i all you need then... just change Howards code to collect $i values into an array.