
- PHP 7 Tutorial
- PHP 7 - Home
- PHP 7 - Introduction
- PHP 7 - Performance
- PHP 7 - Environment Setup
- PHP 7 - Scalar Type Declarations
- PHP 7 - Return Type Declarations
- PHP 7 - Null Coalescing Operator
- PHP 7 - Spaceship Operator
- PHP 7 - Constant Arrays
- PHP 7 - Anonymous Classes
- PHP 7 - Closure::call()
- PHP 7 - Filtered unserialize()
- PHP 7 - IntlChar
- PHP 7 - CSPRNG
- PHP 7 - Expectations
- PHP 7 - use Statement
- PHP 7 - Error Handling
- PHP 7 - Integer Division
- PHP 7 - Session Options
- PHP 7 - Deprecated Features
- PHP 7 - Removed Extensions & SAPIs
- PHP 7 Useful Resources
- PHP 7 - Quick Guide
- PHP 7 - Useful Resources
- PHP 7 - Discussion
How do you make a string in PHP with a backslash in it?
When the backslash \ does not escape the terminating quote of the string or even create a valid escape sequence (in double quoted strings), then the below code can be used to produce one backslash −
Example
$string = 'abc\def'; print($string);
Output
This will produce the following output −
abc\def
Example
$string = "abc\def"; print($string);
Output
This will produce the following output −
abc\def
- Related Articles
- How do I un-escape a backslash-escaped string in Python?
- MySQL query to replace backslash from a varchar column with preceding backslash string values
- How do you make a list iterator in Java?
- How do you make a higher order function in Python?
- How do you make a shallow copy of a list in Java?
- How do you reverse a string in place in JavaScript?
- How do you make a button that adds text in HTML ?
- How would you make a comma-separated string from a list in Python?
- How do you make code reusable in C#?
- How do you make an array in Python?
- How do you convert a string to a character array in JavaScript?
- How do you reverse a string in place in C or C++?
- PHP – Make a lower case string using mb_strtolower()
- Shorten string with a “…” body in PHP?
- What will you do to make your man go crazy in love with you?

Advertisements