Page 1 of 1

again on ereg and empty spaces

Posted: Tue Nov 05, 2002 11:18 am
by leon
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

Posted: Tue Nov 05, 2002 11:28 am
by DoppyNL

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

Posted: Tue Nov 05, 2002 12:23 pm
by leon
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 :) !