I have an associative multidimensional array like this:
[
7 => [49 => null, 41 => null],
8 => [70 => null, 69 => null],
105 => null,
9 => null,
10 => null
]
Now, I need to work with each key, but I am struggling to access all elements through a foreach() loop -- because there are no values. I have been trying to use array_keys(), but that is not suitable for multidimensional keys.
Is there a way I can assign the keys as the values to have a structure like this?
Array
(
[7] => Array
(
[49] => 49
[41] => 41
)
[8] => Array
(
[70] => 70
[69] => 69
)
[105] => 105
[9] => 9
[10] => 10
)
This way I could use a foreach() to get the values of each key.