array to string convesion php code example

Example 1: Array to String Conversion in PHP

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

Example 2: php Array to string conversion

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 !

Tags:

Php Example