Php for nested loop -


Please explain in a broad way how this loop works in PHP?

  ($ A = 1; $ a <10; $ a ++) {echo "& lt; br>"; For ($ b = 0; $ b & lt; $ a; $ b ++) per echo $ a; }   

Why is production 1 22 333 4444 55555 etc and not just 1 2 3 4 5 and so on, I know that something is elementary but I can not get it.

Thank you.

key $ a in internal loop

 < Code> ($ b = 0; $ b   

It will be zero counted as $ a (which increases every time) in each loop and output as $ a .

  $ a = 0: No output (internal loop runs from 0 to 0) $ a = 1: 1 output (internal loop runs from 0 to 1) $ a = 2: 2 Output (internal loop runs from 0 to 2) $ A = 3: 3 output (internal loop runs from 0 to 3) etc. .....    

Comments

Popular posts from this blog

qt - switch/case statement in C++ with a QString type -

python - sqlite3.OperationalError: near "REFERENCES": syntax error - foreign key creating -

Python's equivalent for Ruby's define_method? -