foreach statement

From: Date: Wed, 09 Jan 2002 06:59:29 +0000
Subject: foreach statement
Groups: php.general 
Request: Send a blank email to php-general+get-79873@lists.php.net to get a copy of this message
Okay lets see who has there thinking caps on today (cos I really dont) I have a list of email addresses stored in a text file. I am able to run the script and get all the mail addresses in the list mailed but thats all in one mail. I want to be able to open the file, chop each line and send individual messages to each address.. okay who is confused as Im not giving you much description here, well okay heres what the script looks like.... #!/usr/bin/php -q <? $sms_list = "test_number"; $emails = file($sms_list); for ($i=0; $i < count($emails); $i++) $emails[$i] = trim($emails[$i]); $recipient = implode(",", $emails); print "$recipient"; { $mail_subject="test this"; $mail_body="testing"; mail($recipient, $mail_subject, $mail_body); print "mail sent\n"; } ?> Im just thinking(trying to at least) I need some sort of foreach statement like in perl, right? so that it would say foreach($recipient) { send mail } anyone that could maybe guide me? Thanks in advance C-Ya Chris Grigor ---------------------------------------------------------------------------- -------------- Client Services Call Center: 0860 100 154 Fax: +27 11 340 7345 E-Mail: Support@Bus-Sol.co.za ---------------------------------------------------------------------------- -------------- M-WEB Business Solutions Making it happen. Go shopping @ http://shopping.mweb.co.za Get your business online @ http://business.mweb.com "We all know Linux is great...it does infinite loops in 5 seconds." - Linus Torvalds

« previous php.general (#79873) next »