I am looping through database row results, creating a PDF with the createPDF function below which in turn calls an email function. I am trying to understand whether these processes will run synchronously (waiting for each function to finish before the next loop begins), or whether I am creating a situation where too many processes end up running at once (exceeding memory limit etc.) if the there are many rows to process.
while ($row = mysqli_fetch_assoc($result)) {
global $firstname;
$firstname = $row["first"];
global $email;
$email = $row["email"];
createPDF(); // Calls function to send PDF by email when completed
}
What is the best practice for this scenario?