- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
PHP How to add backslash inside array of strings?
To add backslash inside array of strings, use json_encode().
Let’s say the following is our array −
$value = [ "ADD", "REMOVE","SELECT","MODIFY" ];
We want the output with backslash inside array of strings i.e −
The PHP code is as follows −
<!DOCTYPE html> <html> <body> <?php $value = [ "ADD", "REMOVE","SELECT","MODIFY" ]; echo json_encode(json_encode($value)) . "
"; ?> </body> </html>
This will produce the following output
- How to trim all strings in an array in PHP ?
- Add PHP variable inside echo statement as href link address?
- How to add text inside a Tkinter Canvas?
- PHP program to add item at the beginning of associative array
- How do you make a string in PHP with a backslash in it?
- How to convert array of comma separated strings to array of objects?
- How to add text inside a plot in Matplotlib?
- How to create array of strings in Java?
- C++ Array of Strings
- MySQL query to replace backslash from a varchar column with preceding backslash string values
- Concatenation of two strings in PHP
- In PHP, how can I add an object element to an array?
- Add n binary strings?