How do I output the numbers, 1-11 in a random order like 5, 7, 4, 11, 2, 3, 1, 9, 6, 8, 10
populate an array, call shuffle on it, loop over it and output each item
No offense intended Luke, but IMHO PHP has a fairly well documented manual http://www.php.net/manual/en/function.rand.phpIs there something that fails to do for your needs?
I'm trying to figure out the answer to this sample question...
I know how to generate a random number from 1 to 11 (rand(1,11)) and dont even know where to start (the question doesnt even seem like something like that is doable) Can you give me a point in the right direction?
What do you mean by "grouped together", an array or cocatenated?
$startArray = range(1, 11); // create an array containing the values 1 through 11
shuffle($startArray); // shuffle them so they are in a random order
echo join(', ', $startArray); // output them to the screen
I lloks like after the array is shuffled, the first three elements (1, 2, 3) are grouped together in the array?Is this ok?
$startArray = range(1, 11);
//how do I group the first three elements in the array?, array_chunk
echo join(', ', $startArray);
Give me an example of your expected output.
Are you expecting to just see the first 3 random numbers?