I'm trying to create a version of a poker, where the program hands out 2 cards to each player (6 of them). I've come up with a program that can pick 1 random card for every player, but the problem is that sometimes, 2 players get the same card. My attempt to solve this problem was by giving every loop a diffrent value based on the cards place in the array + the loops value, and then comparing it to earlier loops, but without any sucess...
Here is my currently "working" program:
<?php
$colour = array('Heart', 'Diamonds', 'Spades', 'Clubs');
$card = array('Ace', 2, 3, 4, 5, 6, 7, 8, 9, 10, 'Jack', 'Queen', 'King');
for($i=1; $i<=6;$i++)
{
$m = 0;
$n = 0;
$random1 = array_rand($card);
echo $card[$random1];
$m = $card[$random1];
$random2 = array_rand($colour);
echo " ". $colour[$random2];
$n = $colour[$random2];
}
?>
How should I continue? Is there an easier way to do this?