I have an array with a lot of values inside it. I would like to use a foreach loop to cycle through the array and echo each value on a new line to the HTML page. However, since there are many values, it would look much nicer on the page if I could sort the data into columns. For instance, if there are less than 6 values, just output the data. If there are between 6 and 10 values, output the data into two columns of equal length. And if there are more than 10 values, output the data into three columns of equal length. I already have my array, and I've already used the count() function to return the number of values in the array to a variable. Now I would like to know the best way to go about sorting the results so they go into the appropriate column(s). If there a way to add a limit to the foreach() construct so that I can just run through the first set of values, echo them to one table cell, and then continue the loop in a new table cell? I read in the official documentation that "when foreach first starts executing, the internal array pointer is automatically reset to the first element of the array." What I get out of that is that I can't "stop" the loop and then "continue" it, because the pointer resets if I call foreach() again. But I'm not sure of any other way to do what I am trying to accomplish. Any ideas?