Hello everyone,

I need a favor.

I need to convert this CGI code to PHP code. I don't know about CGI or Perl so i couldn't convert it myself.

Code:
sub URL_encode {
    my($URL)= @_ ;
    $URL=~ s#^([\w+.-]+)://#$1/# ;		     # http://xxx -> http/xxx
    $URL=~ s/(.)/ sprintf('%02x',ord($1)) /ge ;   # each char -> 2-hex
    $URL=~ tr/a-zA-Z/n-za-mN-ZA-M/ ;		  # rot-13
    return $URL ;
}
I will really appreicate if someone could help me out.

Thanks in advance