Indented list to multidimensional array

前端 未结 4 684
后悔当初
后悔当初 2020-12-06 08:21

I was surprised not to find an answer to this on SO (or elsewhere on the internet for that matter). It concerns a nested indented list which I want to convert into a multidi

4条回答
  •  暖寄归人
    2020-12-06 09:04

    There is a class on PHP Scripts that will do what you need. You can find it here: Array To List

    It takes a multidimensional array and creates the HTML.

    Updated

    The opposite to this was actually required. To do this, it's probably best to use a DOMDocument object and load the HTML into a object representation.

    http://php.net/manual/en/domdocument.loadhtml.php

提交回复
热议问题