HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

addslashes

Description

The addslashes of String for PHP 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 $string
): string

Parameters

string

The string to be escaped.

Return

Returns the escaped string.

Examples

1 · single quote

<?

$string = "twelve o'clock";

$return = addslashes($string);

echo $return;
twelve o\'clock

2 · double quote

<?

$string = 'John said, "The time is now."';

$return = addslashes($string);

echo $return;
John said, \"The time is now.\"