谁能帮我理解如何通过 for 循环传递变量?我想打印出变量 $guess 直到数字 40 并打印出“你猜低了”或“你猜得太高了”......我如何将变量与计数器连接起来?
$Me=30;
$guess=$i;
for ($i = 0; $i < 40; $i++) {
if($Me>$guess){
print "$guess:you guessed too low<br />";
}elseif($Me<$guess){
print "$guess: you guessed to high<br />";
}else{
print "you guessed my age! i'm 31!";
}
}