Discover the PHP libraries that help you generate statistics and reports that analyze data from text files, XML, or relational databases.
by Octavia Andreea Anghel
June 24, 2008
tatistics and reports analyze the change over time of any kind of phenomena. For example, you could evaluate an employer's performance by analyzing progress curves provided by reports; managers can make business decisions based on statistical sales data; meteorologists can predict natural disasters based on statistical weather pattern data—and the list goes on. For the software industry, statistics and reports provide both an ongoing challenge and an ongoing market. At present, programming languages such as PHP and Java come with built-in packages for developing applications around statistical problems.
This article explores PHP's support for the statistical domain. You will see how to generate reports and statistics for simple text phrases, XML documents, and complex databases.
The Text_Statistics PEAR Package
The Text_Statistics PEAR package makes it easy to calculate some basic readability metrics on blocks of text. These metrics include such things as the number of words, the number of unique words, the number of sentences, and the number of total syllables. You can use these statistics to calculate the Flesch score for a sentence, which is a number between 0 and 100 that represents readability. Figure 1 shows the formula for the Flesch Reading Ease Score (FRES) test.
It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com. Already a member?
To become a member of DevX.com create your Member Profile by completing the form below. Membership is free!