Imagine having an array like this:
[
'key1' => 'Label 1',
'key2' => 'Label 2',
'key3' => 'Label 3'
];
How can I convert that into a multidimensional array like this:
[
'key1' => [
'key1' => 'Label 1',
'key2' => [
'key2' => 'Label 2',
'key3' => [
'key3' => 'Label 3',
],
],
],
];
I thought about something with a recursive function and array_shift, but I'm not sure how to code it.
The array shall be nested as deep as there are elements.