Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php foreach if last item

$numItems = count($arr);
$i = 0;
foreach($arr as $key=>$value) {
  if(++$i === $numItems) {
    echo "last index!";
  }
}    
Comment

PREVIOUS NEXT
Code Example
Php :: php change file extension 
Php :: session has laravel blade 
Php :: check if logged laravel 
Php :: codeigniter get where 
Php :: uuid package generator laravel 
Php :: php get current year 
Php :: PHP extension simplexml 
Php :: get client size in laravel 
Php :: node dockerfile 
Php :: string to slug php 
Php :: php artisan serve specify ip 
Php :: php object check if property exists 
Php :: php json_encode encode not escape forward slash 
Php :: laravel make:listner 
Php :: flutter boxdecoration add border 
Php :: pretty show php arrays 
Php :: upload file in wp from url 
Php :: parsefloat php 
Php :: remove storefront footer 
Php :: laravel collection shuffle 
Php :: composer require laravel/ui not working laravel 7 
Php :: laravel check if get is empty 
Php :: laravel transactions 
Php :: php grab year from date 
Php :: php read xml from url 
Php :: php delete a folder 
Php :: wordpress update post php 
Php :: js check if div is empty 
Php :: php how to count array 
Php :: laravel destroy session 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =