How to convert an array to string ?

Last updated 4 years, 12 months ago | 1201 views 75     5

Tags:- PHP

PHP | How to convert an array to a string?

array to string

By using implode function we can convert any array to string.  In implode function first parameter is separator which specifies what to put between the array elements. Default is "" (an empty string)

 
<?php

$arr = array('Hello','World!','Beautiful','Day!');

echo implode(" ",$arr);

?>

//output

Hello World! Beautiful Day!