How to Calculate Read Time of Your Blog
The estimated read time for each item is displayed to readers to contemporary web magazines and blogs. Visitors are more likely to read an article after seeing this information, which also enhances user experience. More people see the page, and the bounce rate is reduced. It is possible to integrate this function into a php blog. We'll demonstrate how to create a straightforward PHP script for this purpose in this post.
<?php function readTimeCounter ($content) { $word=str_word_count(strip_tags($content)); $m= floor($word/200); $s= floor($word % 200 / (200/60)); return $res= $m.' min'. ($m ==1? '':'s').', '.$s.'sec'.($s ==1 ? '' :'s'); } $content="Your content goes here"; echo readTimeCounter($content); ?>