[PHP] stripping of the last character

2005-04-18 Thread Ross
I have a large group of email addesses serperated by commas. I need to trim off the very last comma $recipients = [EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED], Also how would I add a space after every comma? to give [EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL PROTECTED] many

Re: [PHP] stripping of the last character

2005-04-18 Thread Sebastian
$recipients = '[EMAIL PROTECTED],[EMAIL PROTECTED],[EMAIL PROTECTED],'; echo str_replace(',', ', ', substr($recipients, 0, -1)); - Original Message - From: Ross [EMAIL PROTECTED] I have a large group of email addesses serperated by commas. I need to trim off the very last comma

Re: [PHP] stripping of the last character

2005-04-18 Thread Chris Kay
use substr($recipients,0,1); to remove the last char and ereg_replace(,, ,,$recipients); to add the spaces Hope this helps CK On Mon, Apr 18, 2005 at 12:05:42PM +0100, Ross wrote: I have a large group of email addesses serperated by commas. I need to trim off the very last comma

Re: [PHP] stripping of the last character

2005-04-18 Thread Richard Lynch
On Mon, April 18, 2005 5:11 am, Chris Kay said: use substr($recipients,0,1); to remove the last char and ereg_replace(,, ,,$recipients); to add the spaces If the list is *REALLY* large, http://php.net/str_replace might be a bit faster. For sure, there's no need to haul out the Ereg