gpt4 book ai didi

PHP while 循环问题

转载 作者:可可西里 更新时间:2023-11-01 13:32:59 32 4
gpt4 key购买 nike

我主要是一个 CSS 和 HTML 的人,但我最近开始涉足 PHP。

我不明白为什么这个脚本会挂起:

$loop_Until = 10;

while($i < $loop_Until)
{
   // do some code here
   $loop_Until = $loop_Until + 1;
}

有人可以帮忙吗?

最佳答案

固定代码

$loop_Until = 10;
$i = 0;

while($i < $loop_Until)
{
// do some code here
$i = $i + 1;
}

代码说明:

// A variable called loop until is set to 10
$loop_Until = 10;

// While the variable i is less than 10
// NOTE: i is not set in code snippet, so we have no way of knowing what value it is, if it is greater than 10 it might be infinite
while($i < $loop_Until)
{
// Increment the 10 value up 1 every time, i never changes!
$loop_Until = $loop_Until + 1;
}

关于PHP while 循环问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3205929/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com