get random element array php code example
Example 1: choose a random word from an array php
$items = array(1, 2, 3, 4, 5);
echo $items[array_rand($items)];
Example 2: laravel random value from array
$k = array_rand($array);
$v = $array[$k];
$items = array(1, 2, 3, 4, 5);
echo $items[array_rand($items)];
$k = array_rand($array);
$v = $array[$k];