- PHP

Generate array of Random Numbers in PHP

You can generate an array with random numbers generated with rand() function inside a loop, or you can generate more numbers with range() and then use shuffle() and array_slice() functions.

Example:

<?php

$numbers = range(0, 50);
shuffle($numbers );
$numbers = array_slice($numbers,0 , 5);

print_r($numbers);

?>