php - Is it possible to have a function that can generate, return, and run a nested for-loop?
function generate_loop($x)
{
...
...
return $loop;
}
generate_loop(3);
generate_loop(6);
for $i...
for $j...
for k...
for $i...
for $j...
for k...
for l...
for m...
for n...
I think you refer this below answer because in this problem is similar but not same this is just for your reference.
PHP - Nest a for loop a variable number of times
I hope this is helpful.
Enjoy Coding.