What is the function of srand in PHP when shuffling an array?
When shuffling an array in PHP using the `shuffle()` function, it is important to use the `srand()` function to seed the random number generator. This ensures that the shuffle order is consistent across multiple calls to the `shuffle()` function. By seeding the random number generator with `srand()`, you can produce the same shuffle result each time the code is executed.
$array = [1, 2, 3, 4, 5];
// Seed the random number generator
srand();
// Shuffle the array
shuffle($array);
// Output the shuffled array
print_r($array);