Find h3 and h4 tags beneath it

appedlyEnhale

New Member
This is my HTML:\[code\]<h3>test 1</h3><p>blah</p><h4>subheading 1</h4><p>blah</p><h4>subheading 2</h4><h3>test 2</h3><h4>subheading 3</h4><p>blah</p><h3>test 3</h3>\[/code\]I am trying to build an array of the h3 tags, with the h4 tags nested within them. An example of the array would look like:\[code\]Array( [test1] => Array ( [0] => subheading 1 [1] => subheading 2 ) [test 2] => Array ( [0] => subheading 3 ) [test 3] => Array ( ))\[/code\]Happy to use preg_match or DOMDocument, any ideas?
 
Back
Top