I\'d like to explode a multi-line-string like this
color:red material:metal
to an array like this
$array[\'color\']=red $array[
Try this
$value = '1|a,2|b,3|c,4|d'; $temp = explode (',',$value); foreach ($temp as $pair) { list ($k,$v) = explode ('|',$pair); $pairs[$k] = $v; } print_r($pairs);