Re: Replacing character.

From: Date: Mon, 11 Feb 2002 13:45:21 +0000
Subject: Re: Replacing character.
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-16793@lists.php.net to get a copy of this message
Hi Barry, To remove all spaces from a string you can use the function str_replace() For example: $mystr="This is a book for sale"; $mystr=str_replace(" ","+",$mystr); Have a look at http://www.php.net/manual/en/function.str-replace.php for further information. It should give you the results you are after... Jerry <Bzdpltd@aol.com> wrote: > I have table that contains alot of fields. Now one of the fields in the databse contains information that I need to be changed when output on a page. > Example: > In the table the field purchase has the following information in 1 of the entries: > This is a book for sale > Now I need this field and this field only on out put to remove all the spaces and replace them with + signs. > So it would look like: > This+is+a+book+for+sale > Thanks all > Barry

« previous php.db (#16793) next »