below is my SQL table
id parent_id
1 0
2 0
3 1
4 1
5 3
6 5
i want to display n’th level hierarchic relation in array like below
array
{
1
sub{
3
sub{
5
}
4
}
}
and so on
how can i do this in PHP
first select all your root categories with parent id 0 and pass their ids to this recursive function