title: How to check for Full House in my poker game?
body: <p>Problem: Creating a video poker game for my internet programming class.</p>
  
  <p>I have everything else working except I'm missing something in my logic down below.
  It returns true for Full House when all I have is 3 of a Kind.</p>
  
  <p>I know my logic for the 3 of the kind works. But when comparing the two cards not involved in the 3 of a Kind is where something is wrong.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>//Calculate if Full House exist
  function checkHouse()
  {
      $kindFlag = false;
      $pairFlag = false;
      $tempCardValue = 0;
      $temp = array();
      $counter = 0;
  
      //check for 3 of a kind, save card positions so they aren't tested for a pair
      for($i=0; $i&lt;3; $i++)
      {
          for($j=($i+1); $j&lt;4; $j++)
          {
              for($k=($j+1); $k&lt;5; $k++)
              {
                  if($this-&gt;Hand[$i]-&gt;GetSortValue() == $this-&gt;Hand[$j]-&gt;GetSortValue() &amp;&amp; $this-&gt;Hand[$i]-&gt;GetSortValue() == $this-&gt;Hand[$k]-&gt;GetSortValue())
                  {
                      $kindFlag =  true;
                      $tempCardValue = $this-&gt;Hand[$i]-&gt;GetSortValue();
                      break 3;
                  }
              }
          }
      }
  
      //Checks 2 remaining cards to see if they match
      for($i=0; $i&lt;5; $i++)
      {
          if($this-&gt;Hand[$i]-&gt;GetSortValue() != $tempCardValue)
          {
              $temp[$counter] = $this-&gt;Hand[$i]-&gt;GetSortValue();
              $counter++;
          }
      }
      if($temp[0] == $temp[1])
      {
          $pairFlag = true;
      }
  
      //Computes Full House or not
      if($pairFlag &amp;&amp; $kindFlag)
          return true;
      else
          return false;
  }
  </code></pre>