URLEncode is used to encode a string with URL encoding PHP function. Useful when a string containing special characters needs to be used in a query as part of a URL. 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.