Quote:
Originally Posted by DrakilorP2P
One-liner and without extra variables:
PHP Code:
serverr.day = this.dayarray[(this.dayarray.index(serverr.day) + 1) % this.dayarray.size()];
Assumes that serverr.day is a valid value.
|
Quote:
Originally Posted by Crow
PHP Code:
this.a = { 1, 2, 3, 4, 5 };
this.aElement = 0;
this.output = this.a[this.aElement];
function NextElement() {
this.aElement = (this.aElement + 1) % this.a.size();
this.output = this.a[this.aElement];
}
|
With the code I posted, I'm not following how to incorporate this into it. Im not asking for an exact example with what I have. If that happens though, please explain.