How can I return multidimensional array keys in tree format in PHP?
For example, if I have the following array:
$array = array (
array (
'name' => 'A',
'product' => array (
'qty' => 1,
'brand' => 'Tim'
),
'goods' => array (
'qty' => 2
),
'brand' => 'Lin'
),
array (
'name' => 'B',
'product' => array (
'qty' => 6,
'brand' => 'Coff'
),
'goods' => array (
'qty' => 4
),
'brand' => 'Ji'
)
);
How can I get a result like the following -- including no repeating of keys:
-name
-product
--qty
--brand
-goods
--qty
--brand