Reply to Re: [PHP] stripping of the last character

Your name:

Reply:


Posted by Richard Lynch on 04/19/05 05:31

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 cannon for something this
simple. :-)

> 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
>>
>> $recipients = jim@email.com,pat@email.com,kevin@email.com,
>>
>>
>> Also how would I add a space after every comma? to give
>>
>> jim@email.com, pat@email.com, kevin@email.com
>>
>>
>> many thanks,
>>
>> Ross
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Like Music?
http://l-i-e.com/artists.htm

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация