📌  相关文章
📜  laravel 循环检查是否达到最后一条记录 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:21.838000             🧑  作者: Mango

代码示例1
$count = 0;
$len = count($array);
foreach ($array as $item) {
    if ($count == 0) {
        // first
    } else if ($count == $len - 1) {
        // last
    }
    // increment
    $count++;
}