Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

again on ereg and empty spaces

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

again on ereg and empty spaces

Postby leon » Tue Nov 05, 2002 11:18 am

Hello

I have a problem ..

if a variable $text contains some empty space " " , I need to replace all this empty spaces with %20 , and the result must gone on $text2 .

How can I do it ? Anyone can help me ?

Thanks
User avatar
leon
New php-forum User
New php-forum User
 
Posts: 36
Joined: Sat Aug 03, 2002 11:54 am

Postby DoppyNL » Tue Nov 05, 2002 11:28 am

Code: Select all
$value = str_replace(' ','%20',$value);


If you're building an URL and want to prevent problems with special characters when it is clicked you should use the function urlencode, that function will also take other characters into account.

Greetz Daan
DoppyNL
 

Postby leon » Tue Nov 05, 2002 12:23 pm

DoppyNL wrote:
Code: Select all
$value = str_replace(' ','%20',$value);


If you're building an URL and want to prevent problems with special characters when it is clicked you should use the function urlencode, that function will also take other characters into account.

Greetz Daan

double thanks , yes I need urlencode :) !
User avatar
leon
New php-forum User
New php-forum User
 
Posts: 36
Joined: Sat Aug 03, 2002 11:54 am


Return to PHP coding => General

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.