How to use variable to get the for loop's value in PHP? -


How to use a varible to store the value of the loop

 For  ($ I = 1; $ i & lt; = $ var; $ i ++)  

How to get the value of $ i and store another value Do and show results for?

I am starting PHP and I want to improve my concept, if anybody can help you, I am so grateful!

Do you want a dynamic variable or just a normal variable that will be passed out to you
12345678910

  & lt; Php $ var = 10; $ One = ''; For ($ i = 1; $ i & lt; = $ var; $ i ++) {$ a = $ I; } Echo $ a; ? & Gt;  

Output:

Or use the following code to create a variable if you want a dynamic variable

  $ {"Num_". $ I} = $ i;  

will output

  $ num_1 = 1; $ NUM_2 = 2; $ Num_3 = 3;  

etc.


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -