I have problem to check either any of my variable contains identical value. Assume I have 8 variable with random generated lowercase alphabet only. For your info, this value don't need to be secure.
$variable1 = random_string();
$variable2 = random_string();
$variable3 = random_string();
$variable4 = random_string();
$variable5 = random_string();
$variable6 = random_string();
$variable7 = random_string();
$variable8 = random_string();
function random_string($length = 6) {
$characters = 'abcdefghijklmnopqrstuvwxyz';
$characters_length = strlen($characters);
$random_string = '';
for ($i = 0; $i < $length; $i++) {
$random_string .= $characters[rand(0, $characters_length - 1)];
}
return $random_string;
}
I have seen this accepted answer at this question. My question, is there any simpler method to compare all this 8 variables if any of this variables have same or identical value? And if it do have same value, then regenerate another random string until none of it contain same value.