I have a string that looks like this:
$dash_access = "1-10:rw,14:rw|10-10:ro,14:ro";
My goal, is to break this string up into an array. I think I'm close, but can't quite figure it out. I want my array structure to look like this:
$array = Array
(
[1] => Array
(
[10] => rw
[14] => rw
)
[10] => Array
(
[10] => ro
[14] => ro
)
)
This is what I have so far, but it's not working.
$dash_access_split = explode("|",$dash_access);
for ($a=0;$a<count($dash_access_split);$a++) {
$split1 = explode("-", $dash_access_split[$a]);
$split2 = explode(",", $split1[1]);
for ($b=0;$b<count($split2);$b++) {
$split3 = explode(":", $split2[$b]);
$dash_access_array[$split1[0]][] = $split3[0];
$dash_access_array[$split1[0]][] = $split3[1];
}
}