Skip to content

Instantly share code, notes, and snippets.

@bondarewicz
Last active December 25, 2015 01:59
Show Gist options
  • Save bondarewicz/6899641 to your computer and use it in GitHub Desktop.
Save bondarewicz/6899641 to your computer and use it in GitHub Desktop.
PHP: Estimated reading time
<?php
function read_time($text){
$words = str_word_count(strip_tags($text));
$min = floor($words / 200);
if($min === 0) return '1 min read';
return $min . 'min read';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment