Share your code editable and funny templates.

Read Time Calculator For Laravel

Published on July 9, 2024 by

Read Time Calculator for Laravel

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
);
}
Dinesh Uprety

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

Filed in:

Discussion

Login or register to comment or ask questions

No comments yet

Be the first to share your thoughts or ask a question.

Join the conversation

Sign in to share your thoughts with the community.

SPONSORED
Codesnap

Codesnap

Share your code editable and funny templates.