There is an array, how to make so that the array key is the same as the id?
Array
(
[0] => Array
(
[id] => 1
[title] => Phones
[parent] => 0
)
[1] => Array
(
[id] => 2
[title] => Apple
[parent] => 1
)
[2] => Array
(
[id] => 5
[title] => Samsung
[parent] => 1
)
)
I tried to do so, but it turns out the other way around, id becomes the same as the array key. It should be the other way around.
foreach ($statement as $key => $value) {
$statement[$key]['id'] = $key;
}