首頁 >後端開發 >php教程 >将已知数组按条件分成若个新数组

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

WBOY
WBOY原創
2016-06-13 11:38:19850瀏覽

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

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 />)

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn