addslashes

Quote string with slashes

A backslash is added before the following characters: single quote ('), double quote ("), backslash (\), and NUL (the NUL byte).

Syntax

addslashes ( string $str ) : string

Parameters

str

The string to be escaped.

Return

Returns the escaped string.

Examples

<?

$str = "twelve o'clock";

$return = addslashes($str);

echo $return;

?>
twelve o\'clock

PHP

Home Menu