php addcslashes function returns a string with a backslash added before the specified character. The syntax is addcslashes(string,characters). The parameter string is required and specifies the string to be escaped. Characters is required and specifies the characters or character range to be escaped.
#How to use the addcslashes function?
Function: Returns a string with a backslash added before the specified character
Syntax:
addcslashes(string,characters)
Parameters:
string Required, specified The string to escape.
characters Required, specifies the characters or character range to be escaped.
Description: Returns the escaped string.
php addcslashes() function usage example:
<?php $str = "Welcome to php.cn!"; echo $str."<br>"; echo addcslashes($str,'m')."<br>"; echo addcslashes($str,'p')."<br>"; ?>
Output:
Welcome to php.cn! Welco\me to php.cn! Welcome to \ph\p.cn!
This article is an introduction to the PHP addcslashes function. I hope it will help you if you need Friends help!
The above is the detailed content of How to use php addcslashes function. For more information, please follow other related articles on the PHP Chinese website!