I have a card game with mixed cards (array with 100 cards, value 1-100, shuffled - alternative would be to random pick by id).
Each player gets a set of cards. The cards are played with POST/ submit.
My problem is that every time I post, the cards are mixed again. But the value of the cards should stay constant while assigned to card-variables.
Is there any possibility to make a random constant afterwards, so that the variable doesn´t get re-assigned when posting/loading?
function mixcarddeck()
{
$carddeck = array(100);
for ($i = 0; $i < 100; $i++) {
$carddeck[$i] = $i + 1;
}
shuffle($carddeck);
}
function givecardvalue($i)
{
$carddeck = mixcarddeck();
return $carddeck[$i];
}
Thanks a lot in advance!