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

PHPServer Side ProgrammingProgramming

<p>Let&rsquo;s say the following is our string array &minus;</p><pre class="result notranslate">$full_name= &#39;[&quot;John Doe&quot;,&quot;David Miller&quot;,&quot;Adam Smith&quot;]&#39;;</pre><p>We want the output in a single string &minus;</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="" rel="nofollow" target="_blank">&nbsp;Live Demo</a></p><pre class="prettyprint notranslate">&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;body&gt; &lt;?php $full_name= &#39;[&quot;John Doe&quot;,&quot;David Miller&quot;,&quot;Adam Smith&quot;]&#39;; $full_name = json_decode($full_name); $filterData = array_filter(array_map(&#39;trim&#39;, $full_name)); $output = implode(&#39;, &#39;, $filterData); echo &quot;The Result in one string=&quot;,$output; ?&gt; &lt;/body&gt; &lt;/html&gt;</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>
Updated on 13-Oct-2020 08:41:18