I am looking to have a function in php created that finds a combination of numbers that add to give you a number that you input into the function.
There is a catch:
I will be provide an array of numbers that are the only ones you may use, and you may not repeat the same number more than once, unless it appears in the array more than once.
You may only add.
What I need returned: an array containing the index values from the initial array showing which numbers you used to get the desired number.
You may use as many or few numbers as you'd like from the provided array. If the numbers can't add to give you the desired number, find the results which give you that closest to the desired number.
You may round to the 2nd decimal place to help as the array may or may not contain decimals past the 2nd decimal place.