php - Filling out a time table with arrays

one text

Solution:

You may use the following way

          Room A    Room B     Room C     Room D
session 1 Jennifer  John       Jane       Lars
session 2 John      Jane       Lars       Jennifer
session 3 Jane      Lars       Jennifer   John
session 4 Lars      Jennifer   John       Jane

The sequence will be Jennifer > John > Jane > Lars

but when you assign from session 1 to session 8

for room A, there is no offset
for room B, there is a offset of ONE (so start with John)
for room C, there is a offset of TWO (so start with Jane)
for room D, there is a offset of THREE (so start with Lars)

So now you may adjust your for loop by using the above offset , I suggest you use 1, 2, 3, 4, 5, 6, 7, 8 for Room 1 , and say 9, 10, 11, 12, 13, 14, 15, 16 for Room 2 (instead of 1, 2, 3, 4 for Room 1, Room 2, Room 3, Room 4 respectively)

Source