听起来您想要这样的东西:
$numItems = count($arr);$i = 0;foreach($arr as $key=>$value) { if(++$i === $numItems) { echo "last index!"; }}话虽这么说,您不必-遍历
foreachphp中使用的“数组” 。

听起来您想要这样的东西:
$numItems = count($arr);$i = 0;foreach($arr as $key=>$value) { if(++$i === $numItems) { echo "last index!"; }}话虽这么说,您不必-遍历
foreachphp中使用的“数组” 。