PHP rawurlencode()

rawurlencode - Encodes the given url string

Function

string rawurlencode ( string $str )

Parameters

$str - The URL string to be encoded.

Return value

Returns a string in which all non-alphanumeric characters except dot (.), dash (-) , underscore (_) and tilde (~) have been replaced with a percent (%) sign followed by two hex digits.

Example

<?php
$str = 'raw url encode';
echo "http://example.com/?param=" . raurlencode( $str );
?>

Output

http://example.com/?param=raw+url+encode

Github

See also: