Please tell me, what is my mistake here:
$myarrayofnames = ["Tisha","Vesta","Josphine"];
$randompick = array_rand($myarrayofnames,1);
if($myarrayofnames[$randompick] === "Tisha") {
$myarrayofnames = ["Vesta","Josphine"];
return $myarrayofnames[$randompick];
}
elseif($myarrayofnames[$randompick] === "Vesta") {
$myarrayofnames = ["Tisha","Josphine"];
return $mymyarrayofnames[$randompick];
}
elseif($myarrayofnames[$randompick] === "Josphine") {
$myarrayofnames = ["Tisha","Vesta"];
return $mymyarrayofnames[$randompick];
}
What I'm trying to do is to pick a random name and make sure the next random name won't be the same as it is now.