title: How would you write this objective-c loop in php?
body: <p>I'm trying to finding out who the next player is in a turn based poker game. In objective c there's no problem, but since Im new to php, I'm not quite sure how to write this loop: </p>
  
  <pre><code>    for (int i = 0; i &lt; [match.participants count]; i++) 
      {
           nextParticipant = [participantsArray objectAtIndex:((currentIndex + 1 + i) % [match.participants count])];
  
      if (nextParticipant.matchOutcome != GKTurnBasedMatchOutcomeQuit)
      {
          //NSLog(@"isn't quit %@", nextParticipant);
          nextPlayer = nextParticipant; 
          break;
      } 
      else
      {
          //NSLog(@"Player not active, continue the for loop to get the next player");
      }
  }
  </code></pre>
  
  <p>So the loop loop through all the participant in the array. THe currentIndex is the index the previous player was at. </p>
  
  <p>So after each turn, the player send his information to the server, along with his index. So if player 4 made his turn, the script should send the turn to player 5, but only if he's active (his status is set to 4, see below)</p>
  
  <p>I can get the active players from the server by: </p>
  
  <pre><code>    $query = "SELECT player1Status, player2Status, player3Status, player4Status,player5Status,player6Status WHERE match_id='$match_id'"; 
  
          while ($row = mysql_fetch_object($result)) {
  
      $player1Status = $row['player1Status'];
      $player2Status = $row['player2Status'];
      $player3Status = $row['player3Status'];
      $player4Status = $row['player4Status'];
      $player5Status = $row['player5Status'];
      $player6Status = $row['player6Status'];
  
  }
  </code></pre>
  
  <p>And I also have the information about the match: </p>
  
  <pre><code>$numberOfPlayersInMatch
  $currentPlayerIndex
  </code></pre>
  
  <p>I just don't know how to put it all together in a good way. Any help is very appreciated. Thanks</p>