Php for loop with 2 variables? -


Is it possible to do this? (Here is my code)

 for  ($ i = 0; $ i & lt; = 10; $ i ++) {for ($ j = 10; $ j & gt ; = 0; $ j -) {resonant "war" $ I. " is " . $ K "& lt; br & gt;"; }}  

I want something like this:

var 0 10

var is 9

var 2 is 8 ...

But my code is wrong, it gives a big list of PP guru, help me!

Try it out:

 For  ($ I = 0, $ K = 10; $ i & lt; = 10; $ i ++, $ k--) {echo "war" $ I. " is " . $ K "& lt; br & gt;"; }  

Two variables $ i and $ k begin with 0 and 10 The $ i one at the end of each of the loops is $ i ++ and $ k < / Code> will be extended ( $ k - ). Then the value of $ i will be values ​​0, 1, ..., 10 and $ k values ​​10, 9, ..., 0.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -