How to echo out sequential numbers? [closed]
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;
}
$i <= 10
need to be adjusted by you- echo $i; will output 1..10 in the example (also needs to be replaced by you)
精彩评论