XML_Statistics
[ class tree: XML_Statistics ] [ index: XML_Statistics ] [ all elements ]

Source for file example3.php

Documentation is available at example3.php

  1. <?PHP
  2. /**
  3. * This example makes use of
  4. * XML_Statistics in conjunction with
  5. * Math_Stats to calculate average occurences
  6. * and other mathematical statistics
  7. * of all tags in the documents
  8. */
  9.     require_once 'XML/Statistics.php';
  10.     require_once 'Math/Stats.php';
  11.  
  12.     $stat = new XML_Statistics();
  13.     $result $stat->analyzeFile("example.xml");
  14.     
  15.     if ($stat->isError($result)) {
  16.         die("Error: " $result->getMessage());
  17.     }
  18.  
  19.     // get number of tags per tagname
  20.     $tags    $stat->getTagOccurences();
  21.  
  22.     // use Math_Stats
  23.     $s = new Math_Stats();
  24.     $s->setData($tags);
  25.     $stats $s->calcBasic();
  26.  
  27.     echo    "<pre>";
  28.     print_r($stats);
  29.     echo    "</pre>";
  30. ?>

Documentation generated on Mon, 11 Mar 2019 15:39:20 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.