I'm using a loop to send mail from an array.
Each time the loop runs the sleep(4);
function is executed.
The problem is that the output of php only happens at the end, ie the echo "</br>n:".$ne." ".$user["email"]."</br> >>enviado</br>";
lines are output all at once and after all loops executed.
I would like as each loop runs, the echo function is displayed (one by one and not one at a time at the end).
foreach($users as $user) {
$message->setTo($user["email"], $user["nome"]);
echo "\n";sleep(4);
flush();
ob_end_flush();
echo date('h:i:s');
$mailer->send($message);
echo date('h:i:s') . "\n";
$ne++;
echo "</br>n:".$ne." ".$user["email"]."</br> >>enviado</br>";