title: How should I suppose to print $headcount alone in the following statement? Suggest any pre-defined functuions too
body: <p>I flip a coin until I get three heads in a row!</p>
  
  <pre><code>&lt;?php 
  
  $headcount = 0;
  $flipcount  = 0;
  
  while ($headcount &lt; 3) {
  
      $flip = rand(0, 1);
      $flipcount++;
  
      if($flip) {
          $headcount++;
          echo "H&lt;br&gt;";   
      }
  
      elseif ($headcount &gt; 3) {
  
          $count_head = $headcount;
          for($i = 0; $i &lt; $headcount; $i++) {
              $count_head = $i; 
          }}  
  
      else {
          $headcount = 0;
          echo "T&lt;br&gt;"; 
      }
  }
  echo "&lt;p&gt;It took {$flipcount} flips!&lt;/p&gt;";
  echo "&lt;p&gt;It took {$count_head} flips!&lt;/p&gt;"; 
  ?&gt;
  </code></pre>