title: PHP based Blackjack script ( aces)
body: <p>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.</p>
  
  <p>Does anyone know how to solve this problem? 
  Function to evaluateHand:</p>
  
  <pre><code>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 &gt; 10 &amp;&amp; $value1 == "A") {
          $value = intval($value) + 1;  // An ace can be 11 or 1
      }
      elseif($value &lt; 12 &amp;&amp; $value1 == "A"){
                     $value = intval($value) + 11;  // An ace can be 11 or 1
          }
  
       else {
          $value = intval($value) + intval($value1);
      }
  }
  return $value;
  }
  </code></pre>