I asked a similair questions and we didn't get to an answer (here). This is a simpler question I hope.
I want to find each set of unique values here. It seems like a array flatten, but how do i keep the parent information. For this tree the answers would be
45, 3, 88
45, 2, 77
45, 5, 67, 2, 35
45, 5, 67, 3, 44
$tree = [
0 => '45',
1 => [
0 => [
0 => '3',
1 => [
0 => [0 => '88'],
],
],
1 => [
0 => '2',
1 => [
0 => [ 0 => '77'],
],
],
2 => [
0 => '5',
1 => [
0 => [
0 => '67',
1 => [
0 => [
0 => '2',
1 => [
0 => [ 0 => '35' ],
],
],
1 => [
0 => '3',
1 => [
0 => [ 0 => '44' ],
],
],
],
],
],
],
],
];