我有以下数组,它在值“/”中有一些额外的字符。
Array
(
[ID1] => 362/2
[ID2] => 589/3
[ID3] => 697/4
[ID4] => 111/5
[ID5] => 422/6
)
我想要实现和得到的如下
Array
(
[ID1] => 362
[ID1] => 2
[ID2] => 589
[ID2] => 3
[ID3] => 697
[ID3] => 4
[ID4] => 111
[ID4] => 5
[ID5] => 422
[ID5] => 6
)
而且,我试图用php编写脚本来解决上述问题......
$exp = array();
foreach ($value as $val) {
$pl = explode('/', $val);
$exp[] = $pl[0] ."=>".$pl[1];
}
print_arr($exp);
但是,我得到了以下结果,这是错误的......
Array
(
[0] => 362=>2
[1] => 589=>3
[2] => 697=>4
[3] => 111=>5
[4] => 422=>6
)
我该怎么做?请帮忙?