944,016 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1680
  • PHP RSS
Nov 7th, 2005
0

str_replace

Expand Post »
How do i use this str_replace with this

bla@bla.com
blac@bla.com
namit@namit.com
and so on

so i have setup

$email = str_replace(" ", ", ", $mail_list);

but it will only talk details if i do this

blac@bla.com bla@bla.com

It does not seam to find and replace return
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
namit is offline Offline
44 posts
since Jun 2005
Nov 7th, 2005
0

Re: str_replace

Quote originally posted by namit ...
How do i use this str_replace with this

bla@bla.com
blac@bla.com
namit@namit.com
and so on

so i have setup

$email = str_replace(" ", ", ", $mail_list);

but it will only talk details if i do this

blac@bla.com bla@bla.com

It does not seam to find and replace return
The 'return' character is not a space, it is '\n'.

-Fredric
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
Daishi is offline Offline
80 posts
since Aug 2005
Nov 8th, 2005
0

Re: str_replace

Not sure how the email list are stored... If they are stored in txt file, then you can use fread to read each line of email address into a string:[php]$mail_list = '';
$handle = @fopen("/tmp/inputfile.txt", "r");
if ($handle) {
while (!feof($handle)) {
$buffer = fgets($handle, 1024);
$mail_list .= $buffer.','; // email addresses
}
fclose($handle);
}[/php]
Reputation Points: 10
Solved Threads: 7
Posting Whiz in Training
zippee is offline Offline
294 posts
since Jan 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Creating an else to a for loop
Next Thread in PHP Forum Timeline: Hey want to change header





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC