开发者

How to echo out sequential numbers? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad,开发者_JS百科 or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

what I have is a number of various places in a class that calls out a number depending on a total number given and I would like to echo out that number. So for example:

Total count may be 4.

here is what may output:

echo "Layer-1" and "Color-1";

some additional coding... then call the same number again elsewhere in the code

echo "Placement-1";

some more coding... blah, blah

echo "FinalArt-1";

Then the loop starts again, only instead of -1 it is -2, and -3 and so on until the final number, in this case 4 has been satisfied.

Can anyone help on this? Newbie, in the house :/


Here is a reference to a for - loop (here: http://php.net/manual/en/control-structures.for.php)

the first example in this reference is:

/* example 1 */

for ($i = 1; $i <= 10; $i++) {
    echo $i;
}
  1. $i <= 10 need to be adjusted by you
  2. echo $i; will output 1..10 in the example (also needs to be replaced by you)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜