【发布时间】:2014-01-26 19:09:48
【问题描述】:
我想知道是否可以在条件语句中使用 $count++ 递增计数器的方法?变量会保持它的新值吗?
$count = 0;
foreach ($things as $thing){
if($count++ == 1) continue;
...
}
【问题讨论】:
-
我想你已经测试过了,发现了你不理解的结果。你能和我们分享一下细节吗?
-
这应该可以。
$count++将增加$count并返回其原始值。
标签: php loops conditional