I have a function my_function() which I need to run 10 times. Right now all 10 functions are running at the same time (asynchronously?). How can the next execution of the function occur after the previous one has finished?
my_function contains CURL calls and reading/writing to database tables. I wonder if any of these are running asynchronously
$repetitions = 10;
for($i = 0; $i < $repetitions; $i++) {
my_function($param);
}
you could use a while loop and call the function within the argument, along with a counter check. then make sure your function returns true or false when it processes.
The loop should block until your function returns true and quit when count criteria doesn’t return true.