![]() |
List of numbers
im wanting to desplay a list of numbers like:
Code:
1Code:
555445thanks in advance |
Hey paulOr, try this:
PHP Code:
|
perfect! <3 thanks alot
|
What's the arguement "1" doing??
|
The third argument to
range is for the step. In other words, how much the resulting numbers should differ by. For example, range(1, 20, 3) would result in an array with values 1, 4, 7, 10, 13, 16 and 19. |
The 1 in the
range specifies how much to step up by on each increment (or decrement). So if it was set to 2 then we would have:
(Salathe beat me to it but I'll keep this in anyway :) |
Ahhh!
Thanks for the heads up! :D |
You could do a simple for loop as well.
PHP Code:
|
I wrote a nice article about range over here. No doubt worth a read!
|
Quote:
|
A similar discussion going on in another part of TalkPHP! I'd always use the for loop as well, to be fair. I don't see the range function as having any other uses apart from that which can be achieved using the for loop. I imagine the range function itself contains nothing more than a for loop.
|
| All times are GMT. The time now is 09:00 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0