Shuffle a string in a repeatable way
Why does it need to be this complicated? PHP has builtins for changing the seed of the random number generator, and for shuffling strings.

function shuffleString($input, $seed = 2000) {
    srand($seed); // set the random generator seed
    $shuffled = str_shuffle($input);
    srand(); // to ensure that the seed is reset
    return $shuffled;
}


This might be less efficient (I haven't benchmarked them) but it's simpler and more readable. Sometimes it's fun to reinvent the wheel, but there are usually shortcuts that can be taken.