Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php get last index end in foreach

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

PREVIOUS NEXT
Code Example
Php :: empty table in laravel 
Php :: php add to array if not exists 
Php :: php verify associative array key eixsts 
Php :: php remove html tags 
Php :: php favicon 
Php :: how to get video duration in php 
Php :: woocommerce change sale text 
Php :: php loop backwards through array 
Php :: laravel public access inserver using htaccess 
Php :: convert object to array laravel 
Php :: laravel 8 $request-intersect not working 
Php :: how to document php api with swagger 
Php :: strlen php 
Php :: php find key in array 
Php :: convert dd/mm/yyyy to yyyy-mm-dd in mysql php 
Php :: php date to seconds 
Php :: php date fomat 
Php :: php remove warning 
Php :: Add 2 hours to current time in cakephp 
Php :: how to search in sentence laravel 
Php :: laravel queue work on shared hosting 
Php :: php artisan drop table 
Php :: laravel firstorcreate 
Php :: laravel validate unique column 
Php :: get category post in wordpress 
Php :: laravel storage save file folder on disk 
Php :: sql repare php 
Php :: php two decimal places 
Php :: php cors multiple headers 
Php :: server error in laravel 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =