<?php
$userRank = array(
"Nightowl",
"Demon Hunter",
"Shadow Walker",
"Legend"
);
$userLevel = array(
"Level 5",
"Level 10",
"Level 15",
"Level 20",
);
$deck = array();
foreach($userRank as $rank){
foreach($userLevel as $level){
$deck[] = array("level" => $level, "rank" => $rank);
}
}
shuffle($deck);
$getVal = array_shift($deck);
echo $getVal['level'] . ' ' . $getVal['rank'];
?>
The end result of this is that the array retrieves random values from the provided a arrays.
Level 10 Nightowl
Level 20 Shadow Walker
What I want is it to output the values according to their index.
Level 5 Nightowl
Level 10 Demon Hunter
Level 15 Shadow Walker
Level 20 Legend
but I want that also to be random in the result of $getVal['level] and $getVal['rank']
So if I call that function, it will call a random line of the 4 I provided but they will match based on their index
Aucun commentaire:
Enregistrer un commentaire