Note: This question may already have an answer, but I probably would not have understood it if Dan D. had not answered me, as he did, precisely and clearly. So thanks again to him.
I would like to get the following arrays in PHP. The pattern is simple: the arrays have a size of from 2 to x, and each element is greater than the previous one. I can do it easily with several loops for a given x, but I would like to do it in general for any x. This seems a little tricky and I can not do it. Can someone help me?
For x = 2:
[1,2]
For x = 3:
[1,2]
[1,3]
[2,3]
[1,2,3]
For x = 4:
[1,2]
[1,3]
[1,4]
[2,3]
[2,4]
[3,4]
[1,2,3]
[1,2,4]
[1,3,4]
[2,3,4]
[1,2,3,4]
For x = 5:
[1,2]
[1,3]
[1,4]
[1,5]
[2,3]
[2,4]
[2,5]
[3,4]
[3,5]
[4,5]
[1,2,3]
[1,2,4]
[1,2,5]
[1,3,5]
[1,4,5]
[2,3,4]
[2,3,5]
[2,4,5]
[3,4,5]
[1,2,3,4]
[1,2,3,5]
[1,2,4,5]
[1,3,4,5]
[2,3,4,5]
[1,2,3,4,5]
For x = 6:
[1,2]
[1,3]
[1,4]
[1,5]
[1,6]
[2,3]
[2,4]
[2,5]
[2,6]
[3,4]
[3,5]
[3,6]
[4,5]
[4,6]
[5,6]
[1,2,3]
[1,2,4]
[1,2,5]
[1,2,6]
[1,3,5]
[1,3,6]
[1,4,5]
[1,4,6]
[1,5,6]
[2,3,4]
[2,3,5]
[2,3,6]
[2,4,5]
[2,4,6]
[2,5,6]
[3,4,5]
[3,4,6]
[3,5,6]
[4,5,6]
[1,2,3,4]
[1,2,3,5]
[1,2,3,6]
[1,2,4,5]
[1,2,4,6]
[1,2,5,6]
[1,3,4,5]
[1,3,4,6]
[1,3,5,6]
[1,4,5,6]
[2,3,4,5]
[2,3,4,6]
[2,3,5,6]
[2,4,5,6]
[3,4,5,6]
[1,2,3,4,5]
[1,2,3,4,6]
[1,2,3,5,6]
[1,2,4,5,6]
[1,3,4,5,6]
[2,3,4,5,6]
[1,2,3,4,5,6]
Etc.