Re: stripping of the last character

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

 






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@xxxxxxxxx,pat@xxxxxxxxx,kevin@xxxxxxxxx,
>>
>>
>> Also how would I add a space after every comma? to give
>>
>> jim@xxxxxxxxx, pat@xxxxxxxxx, kevin@xxxxxxxxx
>>
>>
>> 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

-- 
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