In php, the prerequisite for expressing the total number of loop arrays is for loop.
For example, there are N times in this loop.
So how can we calculate the N value?
Of course, many people will say that $ num = 0; $ num ++;
This is acceptable, but not suitable for my needs,
My requirement is to display this number directly in the for loop.
For ($ I = 0; $ I <9; $ I ++ ){
Total number of cycles * $ I
}
In this case, you can use $ num = 0; $ num ++ in it,
Reply to discussion (solution)
Isn't your cycle number 9?
$ I = 0; $ I <9 can calculate the number of cycles
But I don't think I will ask such a simple question...
Is it estimated that the for loop is an array of unknown stop points?
Either loop twice. for the first time, only the stop point is determined, or the data structure is modified to facilitate management.
The possibility of unreasonable data structures is higher.
The end value of the for loop must be specified.
Isn't this N?
For your
For ($ I = 0; $ I <9; $ I ++ ){
Total number of cycles * $ I
}
Isn't the total number of cycles 9?
If the final value is uncertain, you have to preview it first.
This is generally the case.
For ($ I = 0; $ I
Count ($ arr) * $ I
}