PHP function of the day: array_rand()

For day 20 of 21 in the “PHP Function of the day” series, I’m going to look at array_rand().  The function takes a required array and an optional number of random keys to return.  It returns a random key (not the value). Let’s take a look. <?php $names = array(“Joe”,”Jim”,”Sarah”,”Jill”); $numbers = array(1,2,3,4,5,6,7,8,9); $names_rand_keys = array_rand($names,3); $numbers_rand_keys …

Continue reading "PHP function of the day: array_rand()"