i got a code of 100-200 rules for making a table. but the whole time is happening the same. i got a variable $xm3, then i make a column . next row, i got $xm2 and make column. next row, i got $xm1 and make column.
so my variables are going to $xm3, $xm2, $xm1, $xm0, $xp1, $xp2, $xp3.
is there a way to make a forloop so i can fill $xm and after that a value from the for loop?
As far as I am aware using different variable names is not possible.
However if you uses arrays so as below
or just
$xm[] = "";
Then you can use a for each loop:
Edit: Just Googled and this is possible using variable names but is considered poor practice. Learn and use arrays!
You can do this using variable variables, but usually you're better off doing this sort of thing in an array instead.
If you're positive you want to do it this way, and if 'y' is the value of your counter in the for loop:
You can easily do something like this:
and then you can make a loop creating on the fly the variables; for example:
It is not fully clear what you are asking, but you can do
in PHP, so you can loop through variables with similar names. (Which does not mean you should. Using an array is usually a superior alternative.)
In this kind of structure you'd be better off using an array for these kinds of values, but if you want to make a loop to go through them: