i've got a string that looks something like this:
$string = " 3_spades 3_hearts 10_diamonds 3_diamonds 10_clubs"
i then use this to see if any of the numbers in the string match:
for ($i = 2; $i <= 14; $i++) {
if (substr_count($string, " $i") == 3 {
print "there are three ".$i."'s in your hand.";
break;
}
}
(the spaces are in the string and before the $i to make sure 13 isn't a match for 3, etc. 🙂)
so when $i hits 3, it shows 3 matches. however, now i want it to check if the other 2 numbers match each other and print "full house" if they match.
anyone have any suggestions on how to do this? i've tried a few things and nothing seems to be working.
thanks in advance!