I have this code to get 3 random values from my array:
$maps_clean = array_filter($find_league_maps);
$random_maps = array_rand($maps_clean,3);
$league_match_maps = ",".$maps_clean[1].",".$maps_clean[2].",".$maps_clean[3].",";
This works as long as the array has at least 3 values. Now I want to modify my code so that when I want more random values than I have in my array, it just gets new ones out of the array again. Yes, this means I can have some values more than once.
How would I do that?
array_rand()returns an array full of random keys. You just access the array by its own and don't use$random_mapsat all.[5, 10]and you want 3 random values from it. With what do you want to fill the 3rd one? With a default value such as 100? Or with a value again out of the array, so you end up with[5, 10, 5 or 10]?