php array to string
snippet in php

php array to string

user4244


<?php

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

echo implode(" ",$arr);

?> 

implode php

user5993

$array = array('banana', 'strawberry', 'apple');
comma_separated  = implode(",", $array);
echo comma_separated; // banana,strawberry,apple

php implode array

user6087

$values = array_map('array_pop', $array);
$imploded = implode(',', $values);

php Array to string conversion

user722

Using implode() function in Php
-----------------------
Syntax
implode(separator,array);  

Example
<?php  
//assigning value to the array  
$dummyArr = array("Hello","Greppers,","Ankur","here !");  
  
echo implode(" ",$dummyArr);// Use of implode function  
?>  
  
Output:
Hello Greppers, Ankur here !

implode in php

user4706

<?php
$arr = array('Hello','World!','Beautiful','Day!');
echo implode(" ",$arr);
?> 

Array to String Conversion in PHP

user2014

$gadget = array( 'computer', 'mobile', 'tablet' );
echo implode($arr);