How can developers accurately estimate image loading times in PHP without built-in functions?

When estimating image loading times in PHP without built-in functions, developers can calculate the file size of the image and then use the internet speed of the user to estimate the loading time. This can be done by dividing the file size by the internet speed to get an approximate loading time.

// Calculate the file size of the image
$image_url = 'https://example.com/image.jpg';
$image_size = filesize($image_url);

// Assume user's internet speed in Mbps
$internet_speed = 10;

// Calculate estimated loading time in seconds
$loading_time = $image_size / ($internet_speed * 1024 * 1024);

echo "Estimated image loading time: " . round($loading_time, 2) . " seconds";