Gmann Posted November 6, 2009 Share Posted November 6, 2009 I need to display all possible combinations of an array. The number of elements in an array will be different each time but for example $firstArray = (a,b,c,d,e) This will need to echo the 24 combinations of each. any help greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/180603-combination-formula/ Share on other sites More sharing options...
Daniel0 Posted November 6, 2009 Share Posted November 6, 2009 http://www.phpfreaks.com/forums/index.php/topic,275775.msg1304066.html#msg1304066 Have a look at that. It's not the same, but conceptually it's more or less the same thing. By the way, how did you get to 24 combinations? Mathematically speaking there is only one combination if you use all of them, so I'll assume you mean permutations. Even then there are far more than 24 permutations when selecting 5 elements out of 5 elements. If you don't have any repeats there will be 5!=120 permutations and with repeats there will be 55=3125 permutations. How do you define "combinations"? Quote Link to comment https://forums.phpfreaks.com/topic/180603-combination-formula/#findComment-952853 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.