954,576 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

str_replace

How do i use this str_replace with this

[email]bla@bla.com[/email]
[email]blac@bla.com[/email]
[email]namit@namit.com[/email]
and so on

so i have setup

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

but it will only talk details if i do this

[email]blac@bla.com[/email] [email]bla@bla.com[/email]

It does not seam to find and replace return

namit
Light Poster
44 posts since Jun 2005
Reputation Points: 10
Solved Threads: 0
 

How do i use this str_replace with this

[email]bla@bla.com[/email] [email]blac@bla.com[/email] [email]namit@namit.com[/email] and so on

so i have setup

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

but it will only talk details if i do this

[email]blac@bla.com[/email] [email]bla@bla.com[/email]

It does not seam to find and replace return

The 'return' character is not a space, it is '\n'.

-Fredric

Daishi
Junior Poster in Training
80 posts since Aug 2005
Reputation Points: 10
Solved Threads: 2
 

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]

zippee
Posting Whiz in Training
294 posts since Jan 2005
Reputation Points: 10
Solved Threads: 7
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You