Read Time Calculation helper function
Let's look at an example: The following code is a simple helper function that can calculate the time (in seconds) it takes for a person to read a string passed as an argument:
function calculate_read_time(string $words): int{ return (int) ceil( (Str::wordCount($words) / 265) * 60 );}

Senior Software Engineer • Writer @ Laranepal • PHP, Laravel, Livewire, TailwindCSS & VueJS • CEO @ Laranepal & Founder @ laracodesnap
Filed in: