有可能在PHP重置foreach?
例如:
foreach($rows as $row)
{
if(something true)
{
continue foreach;
}
else
{
break;
reset foreach;//I mean start foreach again...
}
}
Run Code Online (Sandbox Code Playgroud)
----------------------------------编辑
感谢我的朋友给你的答案......
条件从foreach的结果生成所以我不能使用函数.我在很多DIV html中通过(例如)字母表来调整它.对于相同的共振,我无法通过SQL过滤结果.
所以mybe我必须使用css技巧.
你可以围绕这些行做一些事情(并避免递归的限制):
while (True) {
$reset = False;
foreach ($rows as $row) {
if(something true) {
continue;
} else {
$reset = True;
break;
}
}
if ( ! $reset ) {
break; # break out of the while(true)
}
# otherwise the foreach loop is `reset`
}
Run Code Online (Sandbox Code Playgroud)