Convert array to string in PHP

How to convert Array into String in PHP ?

To convert array into string in php  implode() function.The implode() function returns a string from the elements of an array.

The separator parameter of implode() is optional. However, it is recommended to always use two parameters for backwards compatibility.

Syntax :$string=implode(separator,array);
Where $string is a php variable to store string

for an example


<?php
$arr = array(\'A\',\'B\',\'C\',\'D!\');
$string=implode(\" \",$arr);

echo $string;

?>

output will be \”A B C D\”,Since the delimiter is space .

Scroll to Top