addcslashes() function in PHP

王林
Release: 2023-08-25 17:02:01
forward
1018 people have browsed it

addcslashes() function in PHP

The addcslashes() function returns the string with blackslashes.

Note − The addcslashes() function is case-sensitive

Syntax

addcslashes(str, characters)
Copy after login

Parameters

  • str − The string to be escaped

  • characters − The character or character range to be escaped

Return value

addcslashes() function returns a backslash before the specified character String.

Example

The following is an example−

Real-time demonstration

<?php
   $str = addcslashes("First World!","W");
   echo($str);
?>
Copy after login

Output

The following is the output−

First \World!
Copy after login

Example

Let’s see another example−

Demonstration

<?php
   $str = addcslashes("First World!","a..r");
   echo($str);
?>
Copy after login

Output

Here is the output−

F\i\rst W\o\r\l\d!
Copy after login

The above is the detailed content of addcslashes() function in PHP. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template