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
Post a Comment