Menu Samaritan's Purse

URLENCODE

URL-encodes string

SYNTAX

urlencode ( string $str ) : string

PARAMETERS

str

The string to be encoded.

RETURN

Returns a string in which all non-alphanumeric characters except -_. have been replaced with a percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs. It is encoded the same way that the posted data from a WWW form is encoded, that is the same way as in application/x-www-form-urlencoded media type. This differs from the RFC 3986 encoding (see rawurlencode()) in that for historical reasons, spaces are encoded as plus (+) signs.

EXAMPLES

1

-_.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

2

%7E%21%40%23%24%25%5E%26%2A%28%29%2B%3D%7B%5B%7D%5D%7C%5C%3A%3B%22%27%3C%2C%3E%3F%2F

3

+

4

<a href="https://domain.com/path?var=encode+non-alphanumeric">encode non-alphanumeric</a>

INTERNAL

rawurldecode

rawurlencode

urldecode

EXTERNAL

PHP