<?php function estimateReadTime(string $text): int { if (empty($text)) { return 0; } $textOnly = strip_tags($text); $wordsCount = str_word_count($textOnly); $wordsPerMin = 200; return ceil($wordsCount / $wordsPerMin); }
echo estimateReadTime($text) . ' mins'; // ... mins
Hope you found this post useful. It was published . Please show your love and support by sharing this post.