Jump to content

Array help


EchoFool

Recommended Posts

Im really stuck here.

 

I have an array that stores a number of seats from 1 to 8 that are currently booked at a table that is circular.

 

So im trying to make a function to return the next "taken" seat at this round table to the "left" of where your sitting. How ever the problem i face is

when you reach checking seat 8 you need to go to seat 1 as that would be "left" of seat 8.

 

From the array below if i was sat at seat 7 i would need it to then check 8 and then back to one as this would technically be "left" of seat 8 at a round table.

 

Here is an array example of seats that are already taken:

  [0] = 2
  [1] = 3
  [2] = 5
  [3] = 7

 

How on earth do i do it - i can't even think of the logic on this one :S

Link to comment
https://forums.phpfreaks.com/topic/215911-array-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.