$allPackGoods = array(
['id'=>1,'stock'=>14,'num'=>6],
['id'=>2,'stock'=>20,'num'=>6],
['id'=>3,'stock'=>20,'num'=>6],
['id'=>4,'stock'=>18,'num'=>6],
['id'=>5,'stock'=>54,'num'=>6]
);
按照件数去生成数组直到把库存都清空掉
最终结果类似
[[{"id":1,"stock":8,"num":6,"use":6},{"id":2,"stock":14,"num":6,"use":6},{"id":3,"stock":14,"num":6,"use":6}],[{"id":1,"stock":2,"num":6,"use":6},{"id":2,"stock":2,"num":6,"use":6},{"id":4,"stock":12,"num":6,"use":6}]]
但是组合里面不能有相同的id,代码应该如何实现?在线等,求大神解救