I have a for
loop in my code:
$d = count( $v2['field_titles'] );
for( $i=0; $i < $d; $i++ ) {
$current = 3 + $i;
echo 'current is' . $current;
}
How do I know the last iteration if I don't know exact number of $d
?
I want to do something like:
$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;
}
}