我有这样的事情:
$string = "a:3;b:4;c:1;d:9";
我希望:
$array = ['a'=>3, 'b'=> 4, 'c'=>1, 'd'=>9];
由于
答案 0 :(得分:1)
myMessage
最后使用$string = "a:3;b:4;c:1;d:9";
$exploded = explode(";",$string);
$newArr = array();
foreach ($exploded as $single){
$inner = explode(":",$single);
$newArr[$inner[0]] = $inner[1];
}
;