Using PHP DOM XML, I am trying to get the number of nodes in the nodelist by using the length propery of getElementsByTagName.

here's the code:
$doc = new DOMDocument();
$doc->loadXML($response);
$cnt=$doc->getElementsByTagName("entry");
$count=$cnt.length;
print "$count is the length<br>";

but it doesnt give me the length, rather this is the output i get:
"Object id #2length is the length"

Can someone help me out here.
Btw im using PHP5.

Thanx in advance

    Simple typo: $cnt.length instead of $cnt->length
    Happens to all of us; having error_reporting set to E_ALL would have highlighted where the problem was, though.

      thank you weedpacket.

      sometimes these small typo's are soo hard to find and u will end up bald sooner than u expected coz of all the hair pulling out of frustration๐Ÿ˜ƒ ๐Ÿ˜ƒ

        Write a Reply...