标签: php wordpress
使用php我有以下内容:
foreach ( $matches[0] as $match ) { ... }
如何将上述语句更改为仅循环两次然后停止?
非常感谢,
答案 0 :(得分:1)
$i = 0; foreach ( $matches[0] as $match ) { // Your code $i++; if ($i>1){ break; } }