Ticket #735: chunk.php

File chunk.php, 613 bytes (added by Илья Шипицин, 11 years ago)
Line 
1<?php
2
3function dump_chunk($chunk) {
4 echo sprintf("\r\n");
5 echo $chunk;
6 echo "\r\n";
7}
8
9ob_start();
10?>
11<!DOCTYPE html>
12<html>
13 <head>
14 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
15 </head>
16 <body>
17 <?php
18 ob_end_flush();
19 flush();
20 ob_flush();
21 $max = 500;
22 for ($i = 0; $i < $max; $i++) {
23 sleep(1);
24 dump_chunk('Sending data chunk ' . ($i + 1) . ' of '.$max.' <br />');
25 flush();
26 ob_flush();
27 }
28 sleep(1); // needed for last animation
29 ?>
30 </body>
31</html>