Re: str_replace around a character??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx ,email2@xxxxxxxxxx,email3@xxxxxxxxxx ,
> email4@xxxxxxxxxx, "
> 
> to be
> 
> $cc = "email1@xxxxxxxxxx, email2@xxxxxxxxxx, email3@xxxxxxxxxx,
> email4@xxxxxxxxxx"
> 
> 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))));

-- 
Thanks!
-Shawn
http://www.spidean.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux