Generic n-tree in PHP.