Estimated reading time
Estimate the reading time for blog posts. According to Wikipedia1 the average reading speed for an adult on paper is 200 and 180 on monitor. With the quality of monitors (screens) getting better with technology like Retina and high DPI display screens on most android devices I have simply used the 200 word per minute average.
<?php
$words = str_word_count(strip_tags($content));
$min = floor($words / 200);
$sec = floor($words % 200 / (200 / 60));
$est = $min . ' minute' . ($min == 1 ? '' : 's') . ', ' . $sec . ' second' . ($sec == 1 ? '' : 's');
?>
<p>Reading time: <?php echo $est; ?></p>
1 http://en.wikipedia.org/wiki/Words_per_minute#Reading_and_comprehension
Written by Ian Tearle
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#