Assuming an HTML string like this:
$str = '<p>Hello World!</p><p style="text-align:center"><img src="foo.png" /><br /></p>';
It is possible to convert it into an array like this?
[0] => '<p>Hello World!</p>'
[1] => '<p style="text-align:center">'
[2] => '<img src="foo.png" />'
[3] => '<br />'
[4] => '</p>'
I tried using DOMDocument many different ways but the problem seems to always boil down to parenting. I need to traverse the HTML without regard for parent/child relationships.