如何在foreach / for循环中每次添加超过1个?

How do you add more than 1 each time in a foreach/for loop?

I know the basic +1 is like this:

for ($i=1;$i<$nc;$i++){

 echo $i;

}

but I need to add another element which goes up by 5 each time also

    for ($i=1;$i<$nc;$i++){

       // what ever maths to make $plus5 go up by 5 each time

       echo $i . ' - ' . $plus5;

}

so the result would be:

1 - 5
2 - 10
3 - 15
4 - 20
 for ($i=1;$i<$nc;$i++){

       $b = $i*5;

       echo $i . ' - ' . $b . '<br/>';           

}
for ($i=1,$j=5;$i<$nc;$i++,$j=$i*5){
 echo $i.' - '.$j;
}
for ($i=1,$plus5=5;$i<$nc;$i++,$plus5+=5){
   echo $i . ' - ' . $plus5 . "
";
}
for ($i=1; $i<$nc; $i++) {
    echo $i . '-' . $i*5;
}
for($i=1;$i<$nc;$i++)
{
    echo $i.' - '.$i*5;
}
 for ($i=1;$i<$nc;$i++){
    $plus5 = $i*5;
    echo $i." - ".$plus5."
";
 }

if only you want the iteration times 5 use $i * 5 as other mentiened

and you can use like this :

for($i=0, $j=0 ; $i<10 ; $i++,$j = $j+5 ){
    echo $i . "<br/>";
    echo $j. "<br/>";
}

This might be useful:

<?php
for ($i=1;$i<nc;$i++){

     $b = $i*5;
     echo $i . ' - ' . $b;     
     echo '<br/>';
}
?>"

Simply try:

for ($i=1;$i<$nc;$i++){
   // what ever maths to make $plus5 go up by 5 each time
   echo $i*5;

} that's it.then it outputs 5,10,15,20.....