我正在学习 PHP 并尝试编写一个小骰子循环。我想知道如何用更合适的语法重写它:
<?php
$rollcount = 1;
do {
$v = rand(1, 6);
$w = rand(1, 6);
$rollcount++;
echo "<p>$v, $w</p>";
}
while ($v != $w);
if ($v == $w) {
echo "<p>It took $rollcount turns until double!</p>";
} else {}
?>