again on ereg and empty spaces

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

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

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

DoppyNL

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

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

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 :) !


Return to “PHP coding => General”

Who is online

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

cron