내 코드에서 for
루프를 가지고 : 나는 $d
의 정확한 번호를 모르는 경우for 루프의 마지막 반복을 어떻게 알 수 있습니까?
$d = count($v2['field_titles']);
for($i=0; $i < $d; $i++) {
$current = 3 + $i;
echo 'current is' . $current;
}
어떻게 마지막 반복을 알 수 있습니까?
$d = count($v2['field_titles']);
for($i=0; $i < $d; $i++) {
$current = 3 + $i;
if(this is the last iteration) {
echo 'current is ' . $current;
// add sth special to the output
}
else {
echo 'current is ' . $current;
}
}
이
은 $ i가 $ D해야한다 -이 간단한 경우 마지막 반복에서 1, ... – njzk2
, 당신은 단지'에 STH 특수를 추가하려면 루프가 완료된 후에 출력이 출력됩니다. –
@Vohuman 중복이 아님. 내용이나 제목 만 읽었습니까? – JasonMArcher