How can you ensure reproducibility in shuffling a string in PHP?

To ensure reproducibility in shuffling a string in PHP, you can set a specific seed for the random number generator before shuffling the string. This seed will ensure that the random shuffling process is consistent and reproducible each time the code is run.

$string = "Hello, World!";
$seed = 12345; // Set a specific seed for reproducibility
mt_srand($seed); // Set the seed for the random number generator
$shuffledString = str_shuffle($string); // Shuffle the string
echo $shuffledString; // Output the shuffled string