The rawurlencode()
function converts non-alphabetic symbols into numerical
equivalents with a percent sign, such as %28 for "(".
PHP rawurlencode() Function has the following syntax.
string rawurlencode ( string str )
str
is the string value to convert.
PHP rawurlencode() Function returns the encoded string for URL.
You can reverse this conversion using the rawurldecode() function.
This is most commonly used for passing data over URLs.
<?PHP
$name = 'PHP from java2s.com';
$safe_name = rawurlencode($name);
print $safe_name;
?>
The code above generates the following result.