<?php

function dump_chunk($chunk) {
    echo sprintf("\r\n");
    echo $chunk;
    echo "\r\n";
}

ob_start();
?>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    </head>
    <body>
        <?php
        ob_end_flush();
        flush();
        ob_flush();
	$max = 500;
        for ($i = 0; $i < $max; $i++) {
            sleep(1);
            dump_chunk('Sending data chunk ' . ($i + 1) . ' of '.$max.' <br />');
            flush();
            ob_flush();
        }
        sleep(1); // needed for last animation
        ?>
    </body>
</html>
