class node{
public $array_of_childs=array();
public $id;
public $parent_id;
}
There is an array of node objects, each node has a unique id, and an array to contain its child nodes (but empty at the moment, to be populated with its child nodes), nodes having no parent have parent_id set to null.
In the end, the nodes will be displayed in a tree structure.
I can think of some ways to do this but I would love to know if there is an elegant way that you can think of.
Many thanks to you all.
public $array_of_childs=array();
public $id;
public $parent_id;
}
There is an array of node objects, each node has a unique id, and an array to contain its child nodes (but empty at the moment, to be populated with its child nodes), nodes having no parent have parent_id set to null.
In the end, the nodes will be displayed in a tree structure.
I can think of some ways to do this but I would love to know if there is an elegant way that you can think of.
Many thanks to you all.