I'm still wrapping my head around PHP and enjoying learning the language.
I have reached a part that challenges my intelligence (or lack thereof).
I would like to generate a 3 level drop down menu with the information stored in the following array.
The following array is as follows:
Code: Select all
$items = array(
array('id' => '1', 'pid' => '0'),
array('id' => '2', 'pid' => '0'),
array('id' => '3', 'pid' => '0'),
array('id' => '4', 'pid' => '1'),
array('id' => '5', 'pid' => '1'),
array('id' => '6', 'pid' => '1'),
array('id' => '7', 'pid' => '2'),
array('id' => '8', 'pid' => '4')
);
I would like to be able to create a series of nested ul and li items to then style with css.
I've been torturing my little brain with a series of pathetic recursive functions... all they can achieve is an infinite loop of hopelessness.
I would really love it if someone could explain how I should go about achieving this.
Many thanks in advance,
Frank