PHP Programing language

addslash() Function in PHP
Previous Home Next

addcslash()

The addcslashes() function returns a string with backslashes in front of the specified characters.

Syntax :
addcslashes(string,characters)

In syntax, "string" Specifies the string to be escaped and "characters" Specifies the characters or range of characters to be escaped.

Example:

<?php 
$str = addcslashes("Gud Morning...!!","M");
echo($str); 
?>

 

Output:

Gud \Morning...!!

addslash()

The addslashes() function returns a string with backslashes in front of predefined characters like: Single quotes (' '), Double quotes (" "), Backslash (\) and NULL.

Syntax:
addslashes(string)

In syntax, "string" Specifies the string to be escaped.

Example:

<?php 
$str = addslashes('Who are "you"?');
echo($str); 
?>

Output:

\"you\"

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: