Combo problems.. Multi Array??

From: Date: Mon, 14 Jun 2004 07:30:39 +0000
Subject: Combo problems.. Multi Array??
Groups: php.general 
Request: Send a blank email to php-general+get-188196@lists.php.net to get a copy of this message
Hi, I've got a problem which has left me scratching my head for the better part of a week. What I need to do is take x amount of items on one side, and somehow find all the combinations of y that fit in x. Now I know this doesn't make much sense but it is very hard to explain, so I'm probably better off giving an example. In this example just say I have three isntances of x; A, B and C. x can grow to as much as 5 or 6 (D, E, F). On the flipside I have two instances of y; [1] and [2] I need to find how many combinations there are where y can fit in x. The outcome, if working properly, should be...
A [1][2] B        C
A        B [1][2] C
A        B        C [1][2]
A [1]    B [2]    C
A        B [1]    C [2]
A [1]    B        C [2]
A [2]    B [1]    C
A [2]    C        C [1]
A        B [2]    C [1]
Does anyone have any ideas on how I could do this? As I said I'm completely stumped. Thanks, Michael.

« previous php.general (#188196) next »