XML_Statistics::countAttribute() – count the occurences of an attribute


require_once 'XML/Statistics.php';

integer XML_Statistics::countAttribute ( string $attribute = null , string $tagname = null )


Counts how often a certain attribute is used in the document. If no attribute is specified ot will count the total number of tags.

With the second parameter you may limit the search to a special tag.


  • string $attribute - if no attribute name is supplied, all attributes are counted

  • string $tagname - this allows you to limit your search to a tag

Return value

integer occurences of the attribute or a PEAR_Error if the attribute could not be found.


This function can not be called statically.

get the maximum nesting level (Previous) count the occurences of a data blocks (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.