I have a string I would like to separate and make a multidimensional array out of. The string looks like this:\[code\]$string = "item-size:large,color:blue,material:cotton,item-size:medium,color:red,material:silk,";\[/code\]Unfortunately, I have no control over how the string is put together, which is why I'm trying to make this array. My goal is to make an array like this:\[code\]$item[1]['color'] // = blue$item[2]['material'] // = silk\[/code\]So, here's what I've done:\[code\]$item = array();$i=0; // I know this is messy$eachitem = explode("item-",$string);array_shift($eachitem); // get rid of the first empty item foreach ($eachitem as $values) { $i++; // Again, very messy $eachvalue = http://stackoverflow.com/questions/10538246/explode(",",$values); array_pop($eachvalue); // get rid of the last comma before each new item foreach ($eachvalue as $key => $value) { $item[$i][$key] = $value; }}\[/code\]I'm obviously lost with this... any suggestions?