I have a flat array of pipe-delimited strings:
Array
(
[0] => style1|000000
[1] => style2|ff6600
)
I iterate the data like this:
foreach ($styles as $key => $value) {
$sort_values[] = explode('|', $value);
}
print_r($sort_values) shows:
Array
(
[0] => Array
(
[0] => style1
[1] => 000000
)
[1] => Array
(
[0] => style2
[1] => ff6600
)
)
I would actually like a transposed structure with associative first level keys:
Array
(
[styles] => Array
(
[0] => style1
[1] => style2
)
[links] => Array
(
[0] => 000000
[1] => ff6600
)
)