What is the difference between accessing the key and the value in an array when using array_rand in PHP?
When using `array_rand` in PHP to retrieve a random key from an array, you may also need to access the corresponding value associated with that key. To do this, you can simply use the randomly selected key to access the value in the array.
// Get a random key from the array
$randomKey = array_rand($array);
// Access the corresponding value using the random key
$randomValue = $array[$randomKey];
// Output the random key and value
echo "Random Key: " . $randomKey . "<br>";
echo "Random Value: " . $randomValue;