Article readability stats with PHP

With so many technology innovations (mobility, sci-fi screen resolutions) and the attention span shorter than a wing flap of a hummingbird, we are forced to rediscover new ways of optimizing texts for better understanding and ease of use. One common way is the technical improvement of typography, another way is measuring readability. Readability is basically a text usability, and usability is always best improved with proper data to support it.

We had been investigating a couple of options about how to mathematically describe and evaluate texts for our recent project and as a result we developed a simple PHP function that renders some handy content info, such as the number of characters, syllables, words and sentences for each article. Long story short, we are now using it as a standard tool for creating more detailed content audit and to categorize individual articles — as well as site sections — according to target audience age and educational background.

Measuring — and most of all, understanding — that there was a significant number of overly complicated articles on the site helped us to pinpoint the critical parts, suggest copy improvements and allocate the editorial resources.

It’s interesting that the people outside our industry have been using such methods for years. Some public services, for instance The U.S. Department of Defense use the Reading Ease test as the standard test of readability for its documents and forms. Us, web designers are sometimes too arrogant or just plain ignorant about the latest advances in other fields. If we simply reach out and use the wisdom of others, more often than not we can immediately expand our own palette. But I digress.

Automated Readability Index and Flesch–Kincaid readability test are some of the most popular methodologies of qualifying texts in English, but there are many more readability tests including those for Spanish, Dutch, Japanese etc. It was surprising to discover how some of those could help in education to create better learning materials for students…

Even though we are using it with WordPress, the function can be used with any PHP based CMS. Keep in mind that it uses algorithms to evaluate texts in English only. If you plan to use it for measurements in other languages, make sure to adjust the formula accordingly. Please do try to improve the code and let me know your results.

Download cn-article-readability.php

Marko Dugonjić is a designer specialized in user experience design, web typography and web standards. He runs a nanoscale user interface studio Creative Nights and organizes FFWD.PRO, a micro-conference and workshops for web professionals.

Interested in more content like this?