Created
February 23, 2022 08:44
-
-
Save asilbalaban/d3d4f18012d3c728ddc4e21f44fe64d2 to your computer and use it in GitHub Desktop.
obflush foreach in php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$array = ['a', 'b', 'c']; | |
if (ob_get_level() == 0) ob_start(); | |
foreach ($array as $key => $val) { | |
echo $key . ' - ' . $val . '<br>'; | |
ob_flush(); | |
flush(); | |
echo '<script>var scrollingElement = (document.scrollingElement || document.body); | |
scrollingElement.scrollTop = scrollingElement.scrollHeight;</script>'; | |
} | |
ob_end_flush(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment