Why doesn't this code works properly?!
We have an infinite loop here! I want finish the loop when we have 3 top or 3 bottom in a row(it's top and bottom of a coin actually).
<?php
$top = 0;
$bottom = 0;
$flipCount = 0;
while (($top < 3) || ($bottom < 3)) {
$flip = rand(0,1);
$flipCount ++;
if ($flip){
$top++;
$bottom = 0;
echo "<div>top</div>";
}
else {
$bottom++;
$top = 0;
echo "<div>bottom</div>";
}
}
echo "$flipCount flips!";