# 501168 find quantity

I have a problem and I need a php function to solve it.

I have a table like this (it can have multiple any number of rows):

--------------------------------------------

Unit Price | Product Name | Quantity

--------------------------------------------

10.366 test -

25 test -

6.4 test -

---------------------------------------------

TOTAL PRICE : 1665

Now I want to see what are the quantities for the 3 products above so if we do QT1*Price1 + QT2*Price2 + QT3*Price3 = 1665

I need a function that except how much products,prices,total price and max quantity.

And then the function will do all combinations so it find the correct quantities combination, or it returns false if no results.

For example if I give to the function this :

How much products = 3

Max quantity = 2

prices = 5,7,2

total prices = 266

The programm will do like this:

1 1 1 is (1*5 + 1*7 + 1*2) = 266 YES ? returns the 1,1,1 ELSE continue

1 1 2 same..

1 2 1 same...

1 2 2 same...

2 1 1 same...

2 1 2 same...

2 2 1 same...

2 2 2 same...

Beceriler: Her şey Kabul, PHP

İşveren Hakkında:
( 3 değerlendirme )

Proje NO: #2247089

## Seçilen:

zonvra

Hi, i have the job done, please check PMB.

%selectedBids___i_period_sub_7% gün içinde 10%project_currencyDetails_sign_sub_9% %project_currencyDetails_code_sub_10%
(0 Değerlendirme)
0.0