Here is example of code I’m expecting to print message each second.
set_time_limit(0);
foreach($array as $key => $value)
{
echo $value;
sleep(1);
}
I’m wondering is it possible to output results during each step in loop instantly, without waiting until it stops.
yes.
you can do it using php’s flush mechanism.
for example: