Instead of the loop
Normal:
PHP Code:
Opposite: PHP Code:
1 and 2, how to make it in the opposite? THANK YOU! |
Re: Instead of the loop
This question doesn't really make much sense. I think we have an XY Problem here.
Please explain, in detail, what you are actually trying to do. |
Re: Instead of the loop
Quote:
|
Re: Instead of the loop
So if you want to list the latest 5 entries, do for ( new i=max-5; i < max; i++) or do a decrementing loop to start from the end?
|
Re: Instead of the loop
Quote:
|
Re: Instead of the loop
Exactly the way you first posted.
for (new i=max; i > max-5; i--) Depending on how the 'lines' are indexed, you might have to do new i=max-1. for () loops are simple, you just need to learn how they work. They consist of three parameters: starting value, condition that dictates when the loop should break and incremental/decremental value. |
Re: Instead of the loop
Quote:
for the first code, if max = 2, i will become 0, then it will become 1, then the loop will stop for the second code, or opposite as you call it, first i value will be 2(where max=2), second value will be 1 and then it will stop if you're using arrays beware that usually cell alocation starts from pos 0 and ends in pos max-1, so the last character is a string ender(or whatever it's called in english) so you might wanna go for PHP Code:
|
| All times are GMT -4. The time now is 13:12. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.