Go to main content

addslashes

Quote string with slashes.

ADDSLASHES

NAME

addslashes - Quote string with slashes.

SYNOPSIS

addslashes(string)

PARAMETERS

string
The string to be escaped.

RETURN

Returns the escaped string.

DESCRIPTION

This function returns a string after it has escaped every characters that needed to be.

This means that it adds a backslash in front of any of the characters listed below.

An escaped character is a character that invokes an alternative interpretation on subsequent characters in a character sequence (wikipedia). When adding an escaped character in front of another character, it changes its meaning. For example, when you add a backslash in frond of an "n", it means "new line". Those characters are the single or double quote, the backslash and the null character.

EXAMPLES

in:  res={{addslashes("");}}.
out: res=.

in:  res={{addslashes(1);}}.
out: res=1.

in:  res={{addslashes("\\\"'");}}.
out: res=\\\\\"\'.

SEE ALSO

{{ include("includes/strings.sn") }}

AUTHOR

Written by Pusnei Sergey, <sergey@sednove.com>

MODIFICATIONS

1.0 2014-09-09 21:24:14 laplante@sednove.com

Edit

© 2024 extenso Inc. All rights reserved.