

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to remove a character (‘’) in string array and display result in one string php?
<p>Let’s say the following is our string array −</p><pre class="result notranslate">$full_name= '["John Doe","David Miller","Adam Smith"]';</pre><p>We want the output in a single string −</p><pre class="result notranslate">John Doe, David Miller, Adam Smith</pre><p>For this, use json_decode().</p><h2>Example</h2><p>The PHP code is as follows</p><p><a class="demo" href="http://tpcg.io/I1ErzMq0" rel="nofollow" target="_blank"> Live Demo</a></p><pre class="prettyprint notranslate"><!DOCTYPE html> <html> <body> <?php $full_name= '["John Doe","David Miller","Adam Smith"]'; $full_name = json_decode($full_name); $filterData = array_filter(array_map('trim', $full_name)); $output = implode(', ', $filterData); echo "The Result in one string=",$output; ?> </body> </html></pre><h2>Output</h2><p>This will produce the following output</p><pre class="result notranslate">The Result in one string=John Doe, David Miller, Adam Smith</pre>
- Related Questions & Answers
- How to remove the first character of string in PHP?
- How to remove a particular character from a String.
- How to remove the first and last character in a string in R?
- How to remove all common character from string array elements in android?
- Remove new lines from a string and replace with one empty space PHP?
- Remove comma from a string in PHP?
- How to capture the result of var_dump to a string in PHP?
- How to remove the last character from a string in Java?
- How to remove partial string after a special character in R?
- Difference Between Character Array and String
- Find one extra character in a string using C++.
- Difference between String and Character array in Java.
- How to remove only last character from a string vector in R?
- Convert string to character array in Arduino
- Convert character array to string in Arduino
Advertisements