PHP rawurlencode() Function
In this chapter you will learn:
- Definition for PHP rawurlencode() Function
- Syntax for PHP rawurlencode() Function
- Parameter for PHP rawurlencode() Function
- Return for PHP rawurlencode() Function
- Note for PHP rawurlencode() Function
- Example - Encode a string for URL
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// j a va2s . com
$name = 'PHP from java2s.com';
$safe_name = rawurlencode($name);
print $safe_name;
?>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP rtrim() Function
- Syntax for PHP rtrim() Function
- Parameter for PHP rtrim() Function
- Return for PHP rtrim() Function
- Example - trim a string from right
Home » PHP Tutorial » PHP String Functions