1, 2 and 3 combinations

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
lenton
Forum Commoner
Posts: 49
Joined: Sun Jun 20, 2010 6:45 am

1, 2 and 3 combinations

Post by lenton »

If i had this string to show how many numbers there were:
$numbers = 3;
This would mean that I have the numbers 1,2,3.

How would I put them into this order and combination:
I want the shortest combinations first and the lowest number first when possible.
I do not want combinations with two of the same number.
I also need the points between numbers as i later will explode it into an array.

1
2
3
1.2
1.3
2.1
2.3
3.1
3.2
1.2.3
1.3.2
2.1.3
2.3.1
3.1.2
3.2.1

Thank you for you help!
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: 1, 2 and 3 combinations

Post by pickle »

Doesn't sound like you want help, it sounds like you want us to do your work for you. This sounds an awfully lot like a homework assignment.

Have a go at it yourself & post questions about specific problems - don't ask for solutions to your whole project.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply