I am trying to create a new array from an existing one with a random number of records between 2 and 10, I have this so far
//Select a random number
$random_number = (rand(2,10));
// Setup an array of names
$names = array("john", "joe", "simon", "peter", "paul");
// Create new array
$random_field_names = array_rand($names, $random_number);
print_r($random_field_names);
This gives me an array that looks like this
Array
(
[0] => 0
[1] => 10
[2] => 11
)
Where am I going wrong?