What alternative method can be used to shuffle an array and retrieve a random value without using array_rand()?

When array_rand() cannot be used, an alternative method to shuffle an array and retrieve a random value is by shuffling the array using the shuffle() function and then selecting the first element of the shuffled array.

// Original array
$array = [1, 2, 3, 4, 5];

// Shuffle the array
shuffle($array);

// Retrieve a random value from the shuffled array
$randomValue = $array[0];

echo $randomValue;