How can PHP be used to offer downloads at different speeds?

To offer downloads at different speeds using PHP, you can use the `readfile()` function along with setting appropriate headers for the download. By setting the `Content-Length` header to the size of the file and using the `flush()` function to control the download speed, you can achieve different download speeds for users.

$file = 'example.zip';
$download_speed = 1024; // 1 KB/s

header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Content-Length: ' . filesize($file));

$handle = fopen($file, 'rb');
while (!feof($handle)) {
    echo fread($handle, $download_speed);
    flush();
    sleep(1); // 1 second delay for demonstration purposes
}
fclose($handle);