Home  >  Article  >  Backend Development  >  将已知数组按条件分成若个新数组

将已知数组按条件分成若个新数组

WBOY
WBOYOriginal
2016-06-13 12:35:011042browse

将已知数组按条件分为若个新数组
已知数组:

array (<br />
  0 => <br />
  array (<br />
    'po_num' => 'DYNP-770266110-00',<br />
    'plant' => 'DYNP',<br />
    'get_date' => '2013-09-09',<br />
    'cust_no' => '12654172',<br />
    'total' => '615',<br />
    'snp' => '15',<br />
    'mount' => '41',<br />
    'lp_no' => 'P000000D',<br />
  ),<br />
  1 => <br />
  array (<br />
    'po_num' => 'DYNP-770266110-00',<br />
    'plant' => 'DYNP',<br />
    'get_date' => '2013-09-09',<br />
    'cust_no' => '12647212',<br />
    'total' => '60',<br />
    'snp' => '15',<br />
    'mount' => '4',<br />
    'lp_no' => 'P000000D',<br />
  ),<br />
)


能否按字段total为100为单位把数组再分为若干个新的数组?并加上序号字段在其中,比如:
<br />
  array (<br />
    'po_num' => '1/7',//新增字段信息<br />
    'po_num' => 'DYNP-770266110-00',<br />
    'plant' => 'DYNP',<br />
    'get_date' => '2013-09-09',<br />
    'cust_no' => '12654172',<br />
    'total' => '615',<br />
    'snp' => '15',<br />
    'mount' => '41',<br />
    'lp_no' => 'P000000D',<br />
  ),<br />
...<br />
)

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn