12.3. Encoding and Decoding

The functions in this section transform data from one form to another. This includes stripping certain characters, substituting some characters for others, and translating data into some encoded form.

string addcslashes(string text, string characters)

The addcslashes function returns the text argument after escaping characters in the style of the C programming language. Briefly, this means special characters are replaced with codes, such as \n replacing a newline character, and other characters outside ASCII 32–126 are replaced with backslash octal codes.

The optional characters argument may contain a list of characters to be escaped, which overrides the default of escaping all special characters. The characters are ...

Get Core PHP Programming, Third 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.