PHP stripclashes

 The PHP stripcslashes function is used to convert the backslash added by the addcslashes function to the string back to the original string . It can be said to be the reverse application of the addcslashes function. It is usually used to organize the data retrieved from the database. In addition, The stripcslashes function can determine statements similar to C language \n, \r ... etc.


Basic syntax of PHP stripcslashes function

String stripclashes ($ string)


The string $string in the parentheses of the stripcslashes function is a required item, that is, the string to be converted . Like the stripslashes function, no special characters or characters can be specified, and only the backslash in the string ( \), other symbols cannot be eliminated.

PHP stripcslashes function example
<?php
$new_string = "Welcome to \wibibi.It was a very nice day.";
echo $new_string.'<br>';
echo stripslashes($new_string);
?>
The output of the above example is
Welcome to \wibibi.It was a very nice day.
Welcome to wibibi.It was a very nice day.
Thus examples can be learned, PHP stripcslashes functions not only can be used to convert addcslashes treated function string can also be handled originally containing backslash string , but usually simple filtration of the string backslash, The stripslashes function is more straightforward, although the functions of the two are similar.

Post a Comment

0 Comments