PHP rawurlencode() Function

Definition

The rawurlencode() function converts non-alphabetic symbols into numerical equivalents with a percent sign, such as %28 for "(".

Syntax

PHP rawurlencode() Function has the following syntax.

string rawurlencode ( string str )

Parameter

str is the string value to convert.

Return

PHP rawurlencode() Function returns the encoded string for URL.

Note

You can reverse this conversion using the rawurldecode() function.

Example

This is most commonly used for passing data over URLs.


<?PHP/*from  ww  w.  j a  v  a 2s .  co m*/
$name = 'PHP from java2s.com'; 
$safe_name = rawurlencode($name); 
print $safe_name;
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Function reference »




PHP Array Functions
PHP Calendar Functions
PHP Class Functions
PHP Data Type Functions
PHP Date Functions
PHP File Functions
PHP Image Functions
PHP Math Functions
PHP MySQLi Functions
PHP SimpleXML Functions
PHP String Functions
PHP XML Functions
PHP Zip Functions