Implementation of tree structures in php