I have the code below in PHP. I would like him to display echo while running PHP. But it only displays after the while ends. That is, after php finishes running
The intention is to show progress throughout the execution. I wanted the echo to be displayed at the end of each loop
<?php $id_estado = 0; while ($id_estado<5) { echo "OK"; $id_estado++; sleep(2); }
Advertisement
Answer
You will need to set up the output for buffering. Try to place the code before your while loop.
ob_implicit_flush(true); ob_end_flush();