Answers for "get last index from foreach php"

PHP
0

php get last index end in foreach

$numItems = count($arr);
$i = 0;
foreach($arr as $key=>$value) {
  if(++$i === $numItems) {
    echo "last index!";
  }
}
Posted by: Guest on October-02-2021

Browse Popular Code Answers by Language