Simple question:
Why is this:
for($k=1;$k<=10;$k+2) { }
giving an infinite loop? When I change $k+2 by $k++, it works fine.
How can I correct it? (I can’t change the 10 for an impair number because I need this function to work either with a pair or impair value at that place)
This won’t change
$k‘s value, so it never get’s higher than 10. Probably you meant:Which will increase
$kby two each time the expression get’s evaluated (at the end of each for-loop).