How to use addcslashes in PHP
In this article, I will explain how the addcslashes() function can be used in PHP.
addcslashes() function in PHP
- The addcslashes() function is used to return a string with backslashes before of the specified characters in a string.
-
In PHP predefine escape sequences
- \o it is represent the Null.
- \r it is represent the carriage return.
- \n it is represent the newline.
- \f it is represent the form feed.
- \v it is represent the vertical tab.
- \t it is represent the tab.
Syntax
addcslashes(string,characters) |
Parameter
- string string is required parameter. string is determine check to string.
- characters character is required parameter. it is Sequence of characters.
Example
The following example show to how the addcslashes() function can be used in PHP.
<html>
<body>
<h3 style="color: green;">addcslashes() function example in PHP</h3>
<?php
echo addcslashes('c-sharpcorner', '-');
echo '<br>';
echo addcslashes('c-sharpcorner.', '.');
echo '<br>';
echo addcslashes('Welcome to c-sharpcorner','t');
echo '<br>';
echo addcslashes('Welcome to c-sharpcorner','A..Z');
echo '<br>';
?>
</body>
</html>
|
Output
You may also want to read these related articles here
Ask Your Question
Got a programming related question? You may want to post your question here