mardi 13 décembre 2016

Choosing a random array from a list of arrays

Is there any way in PHP to pick a random array from a list of arrays? This is my code:

$array1  = "FFFFFF 000000 111111 222222 333333 444444";
$array2  = "1111 2222 3333 4444 5555 6666";
$array3  = "111 222 333 444 555 666";
$array4  = "11 22 33 44 55 66";
$array5  = "a b c d e f";
$array6  = "1 2 3 4 5 6";

I want to make it so it picks a random array from that list of arrays, but I just cannot figure out how. I tried

$array . rand(1,9)

but unfortunately, PHP won't compile that like I want it to..




Aucun commentaire:

Enregistrer un commentaire