How to un-nest nested lists in php

Silent

New Member
I have a nested unordered list like this (simplified version / the depth is variable) :\[code\]<ul><li><a href="http://stackoverflow.com/questions/1992211/#">Root</a> <ul> <li> <a href="http://stackoverflow.com/questions/1992211/#">Page A</a> <ul> <li> <a href="http://stackoverflow.com/questions/1992211/#" title="Page A1">Page 1 2</a> </li> </ul> </li> </ul></li></ul>\[/code\]Using PHP, is there a nice way to "explode" this nested list in (for this example) 3 lists ?Thanks for your helpEdit :The expected output will be :\[code\]<ul> <li> <a href="http://stackoverflow.com/questions/1992211/#">Root</a> </li></ul><ul> <li> <a href="http://stackoverflow.com/questions/1992211/#">Page A</a> </li></ul><ul> <li> <a href="http://stackoverflow.com/questions/1992211/#" title="Page A1">Page 1 2</a> </li></ul>\[/code\]
 
Back
Top