Created
June 11, 2021 16:54
-
-
Save waxim/c5de4842c030f5fc4336ccfddf666c4a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$teams = [ | |
'Austria', | |
'Belgium', | |
'Croatia', | |
'Czech Republic', | |
'Denmark', | |
'England', | |
'Finland', | |
'France', | |
'Germany', | |
'Hungary', | |
'Italy', | |
'North Macedonia', | |
'Netherlands', | |
'Poland', | |
'Portugal', | |
'Russia', | |
'Scotland', | |
'Slovakia', | |
'Spain', | |
'Sweden', | |
'Switzerland', | |
'Turkey', | |
'Ukraine', | |
'Wales', | |
]; | |
$players = [ | |
'Alan', | |
'Dom', | |
'Leo', | |
'Rob', | |
'Ross', | |
'Gaj', | |
'Dan', | |
'David', | |
'Rhia', | |
'Joe', | |
'Clem', | |
'Claudia', | |
'Claudia K', | |
'John', | |
'Kyle', | |
'Pete', | |
'Corentin', | |
'Arthur', | |
'Fletch', | |
'Johno', | |
'Matt', | |
'Chatity #1', | |
'Charity #2', | |
]; | |
$picks = []; | |
foreach($players as $player) { | |
$pick = array_rand($teams); | |
$picks[$teams[$pick]] = $player; | |
echo "Player $player has picked team " . $teams[$pick] . " from the hat." . PHP_EOL; | |
unset($teams[$pick]); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment