I'm looking for a solution to flatten a variable multi-dimensionaled array to flatten all the values in the last available array to a single Array[] (containing the dataset of each last array in the multidimensional array).
Any help is appreciated!
It differs from other questions
Because the ending result should be a collection of all Arrays containing :
array(
'title' => xx,
'id' => xx
)
listed in the different multidimensional arrays.
The different items all have fixed keys: title and id.
Sample Base array
$data = array(
array(
'title' => xx,
'id' => xx
),
array(
array(
array(
'title' => xx,
'id' => xx
),
array(
'title' => xx
'id' => xx
)
)
),
array(
array(
array(
array(
'title' => xx,
'id' => xx
),
array(
'title' => xx,
'id' => xx
),
array(
'title' => xx,
'id' => xx
)
)
),
array(
'title' => xx,
'id' => xx
),
array(
array(
array(
array(
'title' => xx,
'id' => xx
)
)
)
)
)
);
Should be flattend to
$data = array(
array(
'title' => xx,
'id' => xx
),
array(
'title' => xx,
'id' => xx
),
array(
'title' => xx,
'id' => xx
),
array(
'title' => xx,
'id' => xx
),
array(
'title' => xx,
'id' => xx
),
array(
'title' => xx,
'id' => xx
),
array(
'title' => xx,
'id' => xx
),
array(
'title' => xx,
'id' => xx
)
);
keyentity ... I want the array ofkey/valuesto be kept ...