PHP Loop Question - How Do I Skip Every Nth Line?

Yukimi

New member
I want to echo lines of text from an array but instead of printing each line as it is encountered, I want to skip 2 lines and then print the next line.

array('Line One','Line Two','Line Three','Line Four','Line Five','Line Six','Line Seven'.....)

The result should be like:

"Line One"
"Line Four"
"Line Seven"
"Line Ten"
etc. up to whatever amount there may be.
Then I want to print out the next "set" of lines like:

"Line Two"
"Line Five"
"Line Eight"
"Line Eleven"
etc.

Then lastly:

"Line Three"
"Line Six"
"Line Nine"
"Line Twelve"
 
Back
Top