Script to Generate an array of hierarchical node tree
Consider the file “list.txt” below containing two columns parent id and child id separated by “space” on each row That is the source for data for computation: list.txt 0 1 1 2 2 3 0 4 4 5 0 6 6 7 Below is the script for getting an array of the hierachical node tree tree.php <? $l = file(”./list.txt”);
$list = array();
for ($i = 0;$i < count($l); [...]