HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
PHP String Reference : Add a backslash in front of the character "W"
The addcslashes() function returns a string with backslashes in front of the specified characters.
Parameter | Description |
---|---|
string | Required. Specifies the string to be escaped |
characters | Required. Specifies the characters or range of characters to be escaped |
Return Value: | Returns the escaped string |
---|---|
PHP Version: | 4+ |
Add backslashes to certain characters in a string:
<?php
$str = "Welcome to my humble Homepage!";
echo $str."<br>";
echo addcslashes($str,'m')."<br>";
echo addcslashes($str,'H')."<br>";
?>
Add backslashes to a range of characters in a string:
<?php
$str = "Welcome to my humble Homepage!";
echo $str."<br>";
echo addcslashes($str,'A..Z')."<br>";
echo addcslashes($str,'a..z')."<br>";
echo addcslashes($str,'a..g');
?>
❮ PHP String Reference