Re: Too many arrays! My head is exploding!
| From: | Tedd Sperling | Date: | Tue, 29 May 2012 16:17:06 +0000 |
| Subject: | Re: Too many arrays! My head is exploding! | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-318022@lists.php.net to get a copy of this message | ||
On May 29, 2012, at 11:41 AM, Adam Richardson wrote:
> On Tue, May 29, 2012 at 10:55 AM, Tedd Sperling <tedd@sperling.com> wrote:
>> On 29 May 2012 18:15, Gary <listgj-phpgeneral@yahoo.co.uk> wrote:
>>
>>> Okay, let's assume I have three "things", A, B, and C. I need to produce
>>> an array with a list of all possible combinations of them, however many
>>> there might be in those combinations: e.g. A, B, C, D, AB, AC, AD, BC,
>>> ABC (not sure if I've missed any!). Normally I'm pretty good at working
>>> this stuff out, but to be honest I'm struggling with this one, at least
>>> to do it in any kind of elegant way. Does anyone have any ideas?
>>
>> Sure, but what you are asking for is a permutation and not a combination.
>
> His example seems to suggest order does not matter (I've omitted 'D',
> which I suspect was a typo given the set of A, B, and C):
Ahhh yes, he said AB, AC, BC, and ABC, but not AB, BA, AC, CA, and so on.
I stand corrected.
Cheers,
tedd
_____________________
tedd@sperling.com
http://sperling.com