Name

urlencode

Synopsis

string urlencode(string url)

Returns a string created by URI encoding url. All nonalphanumeric characters except dash (-), underscore (_), and period (.) characters in url are replaced by a sequence of characters beginning with a % followed by a hexadecimal number; for example, slashes (/) are replaced with %2F. In addition, any spaces in url are replaced by plus signs (+). See also rawurlencode(), which is identical except for its handling of spaces.

Get Programming PHP, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.