This is LARA Nepal. X

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

Discussion

Login or register to comment or ask questions

No comments or questions yet...