Php 有人能解释一下$flipCount是如何工作的吗?

Php 有人能解释一下$flipCount是如何工作的吗?,php,Php,我在理解以下递归代码时遇到一些问题: <!DOCTYPE html> <html> <head> <link type='text/css' rel='stylesheet' href='style.css'/> <title>More Coin Flips</title> </head> <body>

我在理解以下递归代码时遇到一些问题:

  <!DOCTYPE html>
   <html>
       <head>
           <link type='text/css' rel='stylesheet' href='style.css'/>
           <title>More Coin Flips</title>
       </head>
       <body>
       <p>We will keep flipping a coin as long as the result is heads!</p>
       <?php
       $flipCount = 0;
       do {
           $flip = rand(0,1);
           $flipCount ++;
           if ($flip){
               echo "<div class=\"coin\">H</div>";
           }
           else {
               echo "<div class=\"coin\">T</div>";
           }
       } while ($flip);
       $verb = "were";
       $last = "flips";
       if ($flipCount == 1) {
           $verb = "was";
           $last = "flip";
       }
       echo "<p>There {$verb} {$flipCount} {$last}!</p>";
       ?>
       </body>enter code here
   </html>

更多的投币
只要结果是正面的,我们将继续掷硬币

在这里输入代码

$flipCount
如何获取
$flip
的数量?我不明白怎么解释,有人能解释一下吗?

嗯。。。由于
$flipCount++
,这相当于
$flipCount=$flipCount+1

上述代码中没有递归……否则,“$flipCount==1”是什么意思?