Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel looping checking if last record has reached

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

PREVIOUS NEXT
Code Example
Php :: cf7 remove p tags 
Php :: Regex to remove span tags using php [duplicate] 
Php :: macrotime phph 
Php :: Laravel Max Helper Function 
Php :: PHP strtok — Tokenize string 
Php :: append single quote around variable in php string 
Php :: how to add x-xss-protection header 
Php :: woocommerce function traduccion label 
Php :: twig to pdf 
Php :: comment blade php 
Php :: php print string as bytes 
Php :: php strip url of all invalid characters 
Php :: laravel what is migrations 
Php :: accept method in jquery 
Php :: woocommerce php reset password length 
Php :: get last name user 
Php :: php move in array 
Php :: laravel collection flatMap 
Php :: distinct in laravel 8 
Php :: console_log in php 
Php :: php location header not working 
Php :: laravel query when 
Php :: $faker-paragraph 
Php :: php const scope 
Php :: laravel gmail send mail 2020 
Php :: guzzlehttp http_errors get 
Php :: guzzle download file 
Php :: encapsulation in php 
Php :: codeigniter 3 session not working after some time 
Php :: remove null values from array php 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =