PHP Tutorial - PHP rawurldecode() Function






Definition

The rawurldecode() function converts a %-escaped string into its original format, reversing the operation of rawurlencode().

Syntax

PHP rawurldecode() Function has the following syntax.

string rawurldecode ( string str )

Parameter

str is the string value to convert.

Return

PHP rawurldecode() Function returns string value in its original format.

Example

Escape string to url format and convert it back


<?PHP
$name = 'PHP from java2s.com'; 
$safe_name = rawurlencode($name); 
print $safe_name;
print "\n";
$unsafe_name = rawurldecode($name); 
print $unsafe_name;
?>

The code above generates the following result.