Basically, I have this code now: PHP: $kills = array(); foreach(["blue", "red", "yellow", "green"] as $color){ $kills[$color] = $this->getTeam($color)->getKills(); } arsort($kills); Now I have an array with the team names and their respective kills. Butt how would I check if 2, 3 or all 4 teams have the same amount of kills and echo that out?
Add this after your foreach loop, it will return the number of teams with the same number of kills PHP: max(array_count_values($kills));
Not meaning to go off-topic, but I actually predicted you will be the one who would answer my question
PHP: <?php$kills = array("red" => 5,"blue" => 4,"yellow" => 3,"green" => 5);//for testing purpose$highest = max($kills);//highest kills$t = array_keys($kills,$highest);//teams with highest number of kills$c = count($t);//number of teams with highest number of killsif($c > 1){ var_dump(implode(', ',$t)." have same amt of kills!");}else{ var_dump(implode(' ',$t)." is first!");}