loops - How long can a php code execute? -
i dont know if right question.
the thing that, have list of users , emails stored in database.
now want send email of them of loop , setting time interval delay (may 5-10 seconds ).
foreach($users $user){ //code send email }
i have around 50 users. code execute until loop complete? mean correct way do?
what if have hundreds or thousands of users in future?
the default max execution time 30
seconds. can modify going php.ini
file , changing max_execution_time
option.
if wish modify max execution time within php script, can use function: set_time_limit ( int $seconds )
, can revert these changes later.
//settings time limit 0 make script execute without time limit(see comments). set_time_limit (0); foreach($users $user){ //code send email } set_time_limit (30);
Comments
Post a Comment