Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php get last index end in foreach

$numItems = count($arr);
$i = 0;
foreach($arr as $key=>$value) {
  if(++$i === $numItems) {
    echo "last index!";
  }
}    
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #index #foreach
ADD COMMENT
Topic
Name
6+9 =