I have seen for $i loops which give special instructions if it is the last element in a loop.
I have this "if last in loop, do this" script working, but can anyone revise it? I have seen a simpler version somewhere using $i < satan, etc![]()
PHP Code:// This outputs "1, 2, 3, 4, 5, 6, 7, 8, 9"
$counter = 1;
$limit = 10;
while($counter < $limit) {
if ($counter == $limit - 1){
print $counter;
} else {
print $counter;
echo ", ";
}
$counter++;
}










Bookmarks