# Getting all combinations of an Array

**URL:** <https://forum.kirupa.com/t/getting-all-combinations-of-an-array/271900>\
**Category:** flash\
**Created:** [September 30, 2008, 6:45am UTC](https://forum.kirupa.com/t/getting-all-combinations-of-an-array/271900 "2008-09-30T06:45:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![AJV55](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@AJV55](https://forum.kirupa.com/u/AJV55)\
**Post date:** [September 30, 2008, 6:45am UTC](https://forum.kirupa.com/t/getting-all-combinations-of-an-array/271900/1 "2008-09-30T06:45:45Z")

</div>

I have an array with 32 objects, each with attributes price and value. I need to get the best possible group of 8 objects - with the best combined values but the price under 50 million $.

I guess the simplest approach would be to count all the possible groups and then order them accordingly - but I just can’t figure out how to list all the combinations to an array…

Any hints would be greatly appreciated!
