hello,
i've been searching for a 'setInterval' function in php and haven't had much luck.
in actionscript (which is similar to php) you can make a function which calls another function at a set interval, and i was keen to do this with php for a mail script so that rather than sending 500 emails at once, i can send 10 emails every 10 seconds etc.
i'm currently thinking i'll have to use flash to make the interval, but would rather keep it all in php.
basically what i want to do is this.
function SendMail($howManyToSend, $fromWhatIndex){ // gets the number of email addresses ($howManyToSend) // from the database, starting at index $fromWhatIndex // then sends them if(all emails sent, no more emails in DB){ return 'finished'; }else{ return 'keep them coming'; } }
function IntervalCalled (){ // increment currentIndex $currentIndex = $currentIndex + 10;
$howDidWeGo = SendMail(10, $currentIndex);
if($howDidWeGo == "finished"){ // FLASH CLEARINTERVAL COMMAND clearInterval($makeEmailsInterval); }
}
// THIS IS HOW I WOULD CALL THE INTERVAL IN FLASH // (for every 10 seconds)
$makeEmailsInterval = setInterval(IntervalCalled, 10000);
so is this possible with PHP by using functions? anything involving complicated server stuff means i may as well setup flash to call the interval instead of PHP
many thanks
andrew
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php