Url Encode Url Decode

PHP urlencode()

urlencode - Encodes url string

Function

string urlencode ( 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 (_) have been replaced with a percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs.

Example
<?php
	$str = 'url encode';
	echo "http://example.com/?param=" . urlencode( $str );
?>
Output
http://example.com/?param=url+encode