// Create a TreeList$tree = new TTreeList();// Assign the result of the database query as the data content for the tree$tree->AssignPDO($rs);

// Check how many records we haveecho "The treelist has ".count($tree)." nodes".PHP_EOL;// Loop the tree as an arrayforeach($tree as $node) {
echo ' '.$node["id"].' - '.$node["name"];
}
echo PHP_EOL;

// Build the tree and index it on the name fieldecho "Building tree".PHP_EOL;$tree->Build('name');

// Display the amount of nodes in the tree (returns 10 since we have two
// duplicates)echo "There is ".$tree->treeCount." nodes in the tree".PHP_EOL;

// Locate a node in the tree$node = $tree->Seek("delta");// If we found a match then display itif($node !== null) {
echo "Found match".PHP_EOL;// Display the number of nodes that matches the searchecho "The match has ".$node->PayloadCount()." data nodes".PHP_EOL;
}?>