I've got a question. I've build this PHP script, it works just fine, except for the fact that aces don't work properly. If I draw 5 A 5 5, it thinks I have 26 etc.
Does anyone know how to solve this problem? Function to evaluateHand:
function evaluateHand($hand) {
global $faces;
$value = 0;
foreach ($hand as $card) {
$values = explode("|",$card);
$value1= $values[0];
if($value1=="Q" OR $value1=="J" OR $value1=="K"){
$value = intval($value) + 10;
}
if ($value > 10 && $value1 == "A") {
$value = intval($value) + 1; // An ace can be 11 or 1
}
elseif($value < 12 && $value1 == "A"){
$value = intval($value) + 11; // An ace can be 11 or 1
}
else {
$value = intval($value) + intval($value1);
}
}
return $value;
}