Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 8a1e68d52d82f5f8f6e27d761b0c7cda > files > 5

php-pear-XML_Statistics-0.2.0-3.mga4.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>";
?>