php knapsack problem