If I wanted to create a foreach
loop that would add every second player to team A or team B
foreach ( $selectedplayers as $selectedplayer ) {
TeamA[] = $selectedplayer;
$selectedplayer++;
TeamB[] = $selectedplayer;
}
I know I can do it with a for
loop but was interested to see if it could be done this way.