| OLD | NEW |
| 1 <?php | 1 <?php |
| 2 function put_chunk($txt) { | 2 function put_chunk($txt) { |
| 3 echo sprintf("%x\r\n", strlen($txt)); | 3 echo sprintf("%x\r\n", strlen($txt)); |
| 4 echo "$txt\r\n"; | 4 echo "$txt\r\n"; |
| 5 } | 5 } |
| 6 | 6 |
| 7 header("Content-type: application/octet-stream"); | 7 header("Content-type: application/octet-stream"); |
| 8 header("Transfer-encoding: chunked"); | 8 header("Transfer-encoding: chunked"); |
| 9 flush(); | 9 flush(); |
| 10 | 10 |
| 11 for ($i = 0; $i < 100; $i++) { | 11 for ($i = 0; $i < 100; $i++) { |
| 12 put_chunk("$i"); | 12 put_chunk("$i"); |
| 13 ob_flush(); | 13 ob_flush(); |
| 14 flush(); | 14 flush(); |
| 15 usleep(1000); | 15 usleep(1000); |
| 16 } | 16 } |
| 17 echo "0\r\n\r\n"; | 17 echo "0\r\n\r\n"; |
| 18 ?> | 18 ?> |
| OLD | NEW |