Re: Re: str_replace around a character??

From: Date: Wed, 13 Jul 2011 16:09:13 +0000
Subject: Re: Re: str_replace around a character??
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-314040@lists.php.net to get a copy of this message
Le 13/07/2011 16:59, Shawn McKenzie a écrit :
On 07/13/2011 02:54 AM, Karl DeSaulniers wrote:
Hello All, I am needing some assistance. I am trying to add some Cc and Bcc to a mail script I have. On the form I have instructions for each to be separated by a comma + a space. In an all perfect world each user would do this perfectly. ...but since were working with something different, how can I check for this? and catch any that dont do this perfectly? Is there a reg exp that covers this? I have seen many, but some make the head cramp. Mi mui novicio. To wrap it up, I am basically trying to do this... $cc = "email1@domain.com ,email2@doamin.com,email3@domain.com , email4@domain.com, " to be $cc = "email1@domain.com, email2@doamin.com, email3@domain.com, email4@domain.com" Any pointers would be much appreciated. TIA Best Regards, Karl DeSaulniers Design Drumm http://designdrumm.com
$cc = implode(', ', array_filter(array_map('trim', explode(',', $cc)))); This should work just fine ;).
$cc = implode(', ', array_filter(filter_var_array(array_map('trim', explode(',', $cc)), FILTER_VALIDATE_EMAIL)));

« previous php.general (#314040) next »