alternator($args)
Parameters: |
|
---|---|
Returns: |
Alternated string(s) |
Return type: |
mixed |
Allows two or more items to be alternated between, when cycling through a loop. Example:
1 2 3 4 | for ( $i = 0; $i < 10; $i ++) { echo alternator( 'string one' , 'string two' ); } |
You can add as many parameters as you want, and with each iteration of your loop the next item will be returned.
1 2 3 4 | for ( $i = 0; $i < 10; $i ++) { echo alternator( 'one' , 'two' , 'three' , 'four' , 'five' ); } |
Note
To use multiple separate calls to this function simply call the function with no arguments to re-initialize.
Please login to continue.