tags:

views:

67

answers:

1

Hi, I need to convert a JS function to PHP

Here is JS function

function urlDecode(str){
    str=str.replace(new RegExp('\\+','g'),' ');
    return unescape(str);
}

Thanks

Riz

+3  A: 

urldecode() is a native php function.

Jasper De Bruijn
http://php.net/urldecode
Dolph
It is in javascript too, oh well not for URLs but URIs: decodeURI() http://www.w3schools.com/jsref/jsref_decodeuri.asp That one catches a lot more than only '+' -> ' '
Roland Bouman