Pull random values from an array with PHP

1 · Josh Sherman · Nov. 16, 2014, midnight
Like most things, you can solve this problem with a number of different approaches. Without knowing about array_rand in PHP, you could end up doing something like this to pull a random value from an array: $array = ['one', 'two', 'three', 'four', 'five']; shuffle($array); echo $array[0]; The array is shuffled......