Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php foreach if last item

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