<script>
var scroller = setInterval(function() {
window.scrollTo(0,document.body.scrollHeight);
}, 10); // update every 10 ms, change at will
</script>
<?php
// generate 1000 lines of html code
for($i=0; $i<1000; $i++){
echo $i . "<br>";
ob_flush(); // flush out the output as we go
flush(); // same
usleep(10000); // add some delay to see it in action
}
?>
<script>
clearInterval(scroller); // stop updating so that you can scroll up
</script>