PHP - split a string of HTML attributes into an indexed array

后端 未结 6 827
后悔当初
后悔当初 2020-12-11 16:20

I\'ve got a string with HTML attributes:

$attribs = \' id= \"header \" class = \"foo   bar\" style =\"background-color:#fff; color: red; \"\';
6条回答
  •  时光说笑
    2020-12-11 16:54

    Easy way could be also:

    $atts_array = current((array) new SimpleXMLElement(""));
    

提交回复
热议问题