urlencode

string urlencode(string data) 

URL-encodes a string, converting spaces into plus (+ ) signs.

Returns:

URL-encoded string; FALSE if the argument passed has no length when converted to a string

Description:

urlencode() makes a string safe to use as part of a URL. It does this by encoding every character within the string that may be misinterpreted by a transport agent (such as an email server) or interpreted as a URI delimiter—for example, the at sign (@), hash (#), and question mark (?) symbols. This includes every character except A–Z, a–z, 0–9, underscore (ASCII value 95), and hyphen (ASCII value 45). Every other character, including accented letters, is converted into a three-digit escape sequence that consists of a literal percent ...

Get PHP Functions Essential Reference 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.