Here is the code I'm using to give the user 13 cards and the cards change every time the page refreshes. What I'm trying to do is give every user 13 cards that are different than the other users where there are 4 users in every room and should be 52 cards.
echo $_SESSION["user"];
echo "<br><br> Your cards :<br>";
function pc_array_shuffle($array) {
$i = count($array);
while(--$i) {
$j = mt_rand(0, $i);
if ($i != $j) {
// swap elements
$tmp = $array[$j];
$array[$j] = $array[$i];
$array[$i] = $tmp;
}
}
return $array;
}
$suits = array('denari', 'kuba', 'sanak', 'shjra');
$cards = array( 2, 3, 'J',4, 5, 6,'Q', 7, 8,'K', 9, 10,'A');
$deck = pc_array_shuffle(range(1,13));
while (($draw = array_pop($deck)) != NULL) {
print "<br>" . $cards[$draw / 4] . ' of ' . $suits[$draw % 4] . "<br>\n";
}