How to get all possible combinations?
I want to try something different with php, and by this I want to apply it to a word problem.
How would I go about getting the possible combinations of 1,2,3,4,5 in possible orders, here are some possible orders, and examples of wrong orders.
2,3,4,5,1 = right
5,4,3,2,1 = right
1,3,2,5,4 = wrong
4,5,6,1,2 = right
It has to follow in sequence. How would i go about getting php to output all possible combinations in that way, or if not all possible combinations in total without the right or wrong? I know for a fact there are some 120 possible combinations, of which only 70 some are able to follow in sequence.
Thanks for your help, I want to test this to get me ready for programing in college.
|