从字符串创建关联数组

时间:2011-09-20 09:24:01

标签: php string associative-array

如何将此字符串“1,2,3,4”转换为此关联数组

array('id' => '1', 'id' => '2', 'id' => '3', 'id' => '4');

使用explode()我得到array('1','2','3','4')

提前致谢

1 个答案:

答案 0 :(得分:2)

你不能这样做,数组的索引必须是唯一的。

相关问题