MEANING OF PHP ADDCSLASHES

PHP ADDCSLASHES Quotes string with slashes in a C style

FULL MEANING OF PHP ADDCSLASHES

Php addcslashes() function as the name implies stands for Add C-style Slashes

PHP ADDCSLASHES stands for Add C-style Slashes.

USAGE OF PHP ADDCSLASHES

PHP ADDCSLASHES returns the escaped string

SYNTAX OF PHP ADDCSLASHES

addcslashes ( $string, $charlist )

TECHNICAL FEATURES OF PHP ADDCSLASHES

Supported in (PHP 4, PHP 5, PHP 7)

DESCRIPTION OF PHP ADDCSLASHES

PHP ADDCSLASHES function returns a string that have backslashes before characters which are listed in charlist parameter.

PARAMETERS / PROPERTIES OF PHP ADDCSLASHES

$string The string to be escaped.
$charlist A list of characters to be escaped.

EXAMPLE(S) OF PHP ADDCSLASHES #1

<?php
echo addcslashes('Shopinson', 'A..z');
?>

The example will output “\S\h\o\p\i\n\s\o\n

EXAMPLE(S) OF PHP ADDCSLASHES #2

<?php
echo addcslashes('Hello Mr. Shopinson', 's')."<br>"; //Output "Hello Mr. Shopin\son"
echo addcslashes('Hello Mr. Shopinson', 'o')."<br>"; //Output  "Hell\o Mr. Sh\opins\on"
echo addcslashes('Hello Mr. Shopinson', 'M')."<br>";//Output "Hello \Mr. Shopinson"
?>

This example outputs the result below

Hello Mr. Shopin\son
 Hell\o Mr. Sh\opins\on
 Hello \Mr. Shopinson

EXAMPLE(S) OF PHP ADDCSLASHES #3

<?php
echo addcslashes("shopinson['.'].com", 'z..A');
?> 

The example outputs “\s\h\o\p\i\n\s\o\n\['.'\].\c\o\m

LEAVE A REPLY

Please enter your comment!
Please enter your name here