I have the following array, how can i make a select with level indication.
The level indication must be - level 1 , -- level 2, -- level 3 --- , .......
array( 0 => array(
'id' => 1,
'name' => 'Bikes',
'description' => 'bikes desc',
'parent_id' => 0
'childs' => array(
0 => array(
'id' => 2,
'name' => 'Mountainbike',
'description' => 'mountainbike desc',
'parent_id' => 1,
'childs' => array(
0 => array(
'id' => 3,
'name' => 'Mountainbike spikes',
'description' => 'Mountainbike spikes',
'parent_id' => 2
),
),
),
1 => array(
'id' => 5,
'name' => 'Sportbike',
'description' => 'sportbike',
'parent_id' => 1
),
),
),
1 => array(
'id' => 4,
'name' => 'Car',
'description' => 'car',
'parent_id' => 0
),
);
Desirable output:
<select>
<option id="1">Bikes</option>
<option id="2">- Mountainbike</option>
<option id="3">-- Mountainbike spikes</option>
<option id="5">- Sportbike</option>
<option id="4">Car</option>
</select>