Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > media > contrib-release > by-pkgid > 1b406f09fefde897c9085a7499511cf6 > files > 5

php-pear-XML_Statistics-0.1-11mdv2010.1.noarch.rpm

<?PHP
    require_once 'XML/Statistics.php';
    
    $stat = new XML_Statistics();
	$xml  = implode("",file("http://pear.php.net/rss.php"));
	
    // analyze a string instead of a file
    $result = $stat->analyzeString($xml);
    
    if ($stat->isError($result)) {
        die("Error: " . $result->getMessage());
    }
    
    echo    "Total tags: " . $stat->countTag()."<br>";
    echo    "Occurences of item: " . $stat->countTag('item')."<br>";
    echo    "Maximum nesting level: " . $stat->getMaxDepth()."<br>";

    // these are the <item> tags => amount of news entries
    echo    "Amount of Tags in depth 3: " . $stat->countTagsInDepth(3)."<br>";
?>