首页 >后端开发 >php教程 >将已知数组按条件分成若个新数组

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

WBOY
WBOY原创
2016-06-13 11:38:19848浏览

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

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