HarryHuy Posted December 15, 2014 Share Posted December 15, 2014 I want to iterate through each element on an html page and echo each element's name. I thought this should work: $tags = $doc->getElementsByTagName('*'); foreach ($tags as $tag) { echo $tag->tagname; } but I am getting the error: Notice: Undefined property: DOMElement::$tagname in C:\...\ on line 51 Quote Link to comment Share on other sites More sharing options...
Solution Ch0cu3r Posted December 15, 2014 Solution Share Posted December 15, 2014 (edited) Line 51 should be (name starts with a capital letter) echo $tag->tagName; Variable/property names are case sensitive Edited December 15, 2014 by Ch0cu3r Quote Link to comment Share on other sites More sharing options...
HarryHuy Posted December 15, 2014 Author Share Posted December 15, 2014 Line 51 should be (name starts with a capital letter) echo $tag->tagName; Variable/property names are case sensitive Thanks a lot for the help! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.