title: Order Optimization with PHP and MySQL
body: <p>I have a MySQL table with products available in pack configurations like:</p>
  
  <pre><code>SKU   PACK
  xyz     25
  abc    250
  </code></pre>
  
  <p>A user can select the number of items they want in multiples of 25. I'd like to be able to fill an order using the largest packs possible. For example if a user wants 275 products then I would fill the order with 1 of the abc sku and 1 of the xyz sku. If a user wanted 225 products then I would fill the order with 9 xyz.</p>
  
  <p>I'm having trouble approaching the problem and am looking for suggestions on an approach. Pseudo-code or PHP would be awesome.</p>