The rawurlencode() function is an inbuilt function in PHP which is used to encode the URL(Uniform Resource Locator) according to RFC(Uniform Resource Identifier) 3986.
string rawurlencode( $str )
Parameters: This function accepts single parameters $str which is mandatory. It is used to store the URL which is to be encoded.
Return Value: This function returns a string which contains all non-alphanumeric characters except -_.~ symbols. The symbols or space character replaced with a percent (%) sign followed by two hex digits.
Below programs illustrate the rawurlencode() function in PHP.