<?php
$cnt = 1;
$length = count($array);
$array = [0 => "aaa",
1 => "bbb",
2 => "ccc",
3 => "bbb",
4 => "ddd",
5 => "ccc"];
foreach($array as $k=>$v){
if($cnt < $length){
print "$k=>$v まだまだ\n";
}else{
print "$k=>$v 最後\n";
}
$cnt++;
}
コメント