Sorry about the pretty bad title, I'm not a native speaker and wasn't sure how to phrase this.
Here is my problem:
I have a very long array with this format:
$array = array(
'key1.value1' => '1',
'key1.value2' => '0',
'key1.value3' => '1',
'key2.value1' => '0',
'key2.value2' => '0',
'key3.value1' => '1'
);
From this array, I would like to get another one with this format:
$newArray = array(
'key1' => array(
'value1' => '1',
'value2' => '0',
'value3' => '1'
),
'key2' => array(
'value1' => '0',
'value2' => '0'
),
'key3' => array(
'value1' => '1'
)
);
I have tried a few methods but really didn't find any solution that isn't extremely long, so I wondered if I could any tips/tricks to get this done easily!
Thanks a lot!
in_array(string, $array);