foreach 구문에서 배열 마지막인지 확인
==================================================
<?
$a=array("1","2","3","4","5","6","7","8");
foreach($a as $key=>$value)
{
if(end($a)==$value)
{
echo"마지막 :: <font color=red>$value</font>";
}
else
{
echo" $key :: $value <br>";
}
}
?>
========================================
0 :: 1 1 :: 2 2 :: 3 3 :: 4 4 :: 5 5 :: 6 6 :: 7 마지막 :: 8
|