How to remove a character (‘’) in string array and display result in one string php?

PHPServer Side ProgrammingProgramming

Let’s say the following is our string array −

$full_name= '["John Doe","David Miller","Adam Smith"]';

We want the output in a single string −

John Doe, David Miller, Adam Smith

For this, use json_decode().


The PHP code is as follows

 Live Demo

<!DOCTYPE html>
$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;


This will produce the following output

The Result in one string=John Doe, David Miller, Adam Smith
Published on 13-Oct-2020 08:40:55