Avatar of Luey
Luey
Flag for United States of America

asked on 

array_rand() question

I want to randomly choose items in my array and keep their values.

when I run this on my array
print_r($array_local_ids);

echo "</br>";

print_r(array_rand($array_local_ids,2));

Open in new window


it prints this
Array ( [0] => 175 [1] => 174 [2] => 177 [3] => 179 [4] => 176 )
Array ( [0] => 2 [1] => 4 )

i want the values of the first array in my random array not the keys of the first array.
PHP

Avatar of undefined
Last Comment
Ray Paseur

8/22/2022 - Mon