Need help with if/elseif


#1

Hej ppls … could someone please help me out with this?

If i have 4 teams (counting points together) and i know how to do it with 2 teams … but i have problems to do it with 4 teams.
Like if team_one is better than team_three but worse than team_two and so on … ;(
This is my sample for two teams…

Would be really great if someone could help me :slight_smile:

	if ($team_one == $team_two) {
		//booth are the same
	} elseif ($team_one > $team_two) {
		//team_one is better
	} else {
	   //team_two is better
	}

#2

What do you want to end up with? The best team? Teams sorted by points?


#3

Hej … thx for response.
I think i found my soloution. :wink:

$scoreid = 1;

	$points = array();
	$points[] = array('Punkte' => $team_one_points, 'Team' => $team_one);
	$points[] = array('Punkte' => $team_two_points, 'Team' => $team_two);
	$points[] = array('Punkte' => $team_three_points, 'Team' => $team_three);
	$points[] = array('Punkte' => $team_four_points, 'Team' => $team_four);

	rsort($points);
	foreach ($points as $key => $val) {
		$punkte[$key] = $val['Punkte'];
		$team[$key] = $val['Team'];
		echo "<tr>\n
				<td cellpadding='2'>".$scoreid."</td>\n
				<td cellpadding='2'>".$val['Team']."</td>\n
				<td cellpadding='2'>".$val['Punkte']."</td>\n

		      </tr>\n";
		$scoreid++;
	}