urlencode - Encodes url string
string urlencode ( string $str )
$str - The url string to be encoded.
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.
<?php
$str = 'url encoder';
echo "http://example.com/?param=" . urlencode( $str );
?>
http://example.com/?param=url+encoder