have you ever noticed that some websites use the plus sign (+) in their urls. i've een some site that also have the %20 (percentage sign character) in the urls to be used for the space character. today wanted to change a url into a string but couldn't figure out how to remove them. i found different way to remove the plus sign from the url string, but the best way to remove the plus sign from the url is with the url decode function in PHP. so today in this little tutorial i will show you how you can remove the + sing from a url with a sample code.

by the way, thanks for the folks at www.webune.com for their support on this question. i am writing this short tutorial here just in case anyone who may have a question like may also have this same question.

so in my example, lets say i have this url:
http://www.wallpaperama.com/search/?q=free+wallpapers+at+wallpaperama&meta=3&lan=en

ok, to make it simple and easy to strip the plus sign off the url, i could use this code:

CODE:
#declare the $url string
$url = "http://www.wallpaperama.com/search/?q=free+wallpapers+at+wallpaperama&meta=3&lan=en";

# Get the + out of the url
$url =  urldecode($url);

#display the $url string
echo $url;


so the ouput will look like this:

http://www.wallpaperama.com/search/?q=free wallpapers at wallpaperama&meta=3&lan=en

try it yourself, you'll see that it works. The only thing you need is a text editor like notepad and PHP hosting.

if you have windows you can use notepad, if you are using linux you can use nano or VI, whichever you prefer.

the other thing you are going to need is PHP hosting. if you don't have PHP on your site, you can get PHP hosting from our friends at www.webune.com

hope this has helped you. any comments are welcome.

also, if for some reason you want to add the plus sign on the url, the change the line:

FROM:
CODE:
$url = urldecode($url);

TO:
CODE:
$url =  urlencode($url);