I've got an array containing
"1", "2", "3", "4"
And I use array_rand to select one of those numbers randomly five times. Then I want to count how many of the result of array_rand that have been chosen multiple times like the number 2 got chosen 2 times and number 3 got chosen 2 times.
I have tested doing this
$array = array($kort1[$rand_kort1[0]], $kort1[$rand_kort2[0]], $kort1[$rand_kort3[0]], $kort1[$rand_kort4[0]], $kort1[$rand_kort5[0]]);
$bank = array_count_values($array);
if (in_array("2", $bank)) {
echo "You got one pair";
} elseif(in_array("2", $bank) && (???)) {
echo "You got two pair";
}
it will tell me "You got one pair" if one of those numbers were randomly chosen 2 times but my problem is I don't know how to make it say "You got two pairs" if 2 of those numbers were chosen 2 times.
the result of $bank could be
[4] => 1 [3] => 2 [1] => 2
[3] => 2 [1] => 3considered two pairs?[3] => 4 [1] => 1