PHP Estimate Reading Words Per Minute

PHP Estimate Reading Words Per Minute

Estimate the reading time by calculating the words per minute using PHP.

Fiction, scientific, technical content types can affect the words per minute. The ability and knowledge of the reader can also affect the estimate. For example, it is assumed that children and seniors will have a lower estimate than recent college graduates.

Estimated Reading Rates

Reading Rates For Fiction
Age Silent Oral
Children 80 – 204 54 – 151
Adults 250 – 350 175 – 225
Senior 175 – 245 125 – 160
silent 235
oral 181

Glossary:

Children

People who are not yet in high school.

Adults

From teens in high school to middle-aged people.

Seniors

People who are 65 years old and older

<?php
$paragraph = "The shoes had been there for as long as anyone could remember. In fact, it was difficult for anyone to come up with a date they had first appeared. It had seemed they'd always been there and yet they seemed so out of place. Why nobody had removed them was a question that had been asked time and again, but while they all thought it, nobody had ever found the energy to actually do it. So, the shoes remained on the steps, out of place in one sense, but perfectly normal in another.";
$number_of_words = str_word_count($paragraph); // Word Count
$words_per_minute = 200; // Set Words Per Minute
$estimated_minutes = ($number_of_words / $words_per_minute);  // Estimated Minutes To Read
echo "It will take {$estimated_minutes} to read the paragraph.";
?>

Explanation:

  1. Obtain the number of words in the paragraph.
  2. Set the words per minute based on the target audience.
  3. Divide the number of words by the words per minute.
  4. Print the estimated minutes.

Screenshots:

Estimate Reading Words Per Minute Via PHP
PHP Estimate Reading Words Per Minute Output

The concepts from the example above can be found in Learning PHP which is an online ebook. The only requirement is a web browser. You can use the built-in Web IDE to view your code and compile it online to view the result. You pay once for the online book and get access to the book at anytime without extra costs.

Conclusion:

Words per minute are calculated by first counting all the words. Second divide the number of words the estimated words per minute of the target audience.

Take this opportunity to learn PHP programming language by making a one-time purchase at Learning PHP. A web browser is the only thing needed to learn PHP in 2024 at your leisure. All the developer tools are provided right in your web browser.

References:

  • Learning PHP
  • Scholar Within. Average Reading Speed By Age And Grade level
  • Brysbaert, Marc, 2019. How many words do we read per minute? A review and meta-analysis of reading rate. Journal of Memory and Language, Volume 109, December 2019, 104047

Leave a Reply

Your email address will not be published. Required fields are marked *