Showing posts with label PHP Array to String. Show all posts
Showing posts with label PHP Array to String. Show all posts

Saturday, 27 September 2014

implode in PHP

PHP implode() function is utilized to returns a string formed from the elements of an array.
PHP implode() function is easily remembered as "array to string", which simply means that it takes an array and returns a string.


Syntax:
implode(separator,array)

Parameters description:
separator : Optional. Connector between the array elements.Default is empty string(“ ”).

array : Required. The array who's elements will be joined.

Example:


<?php

$array_name = array('Today','is','Monday!');
$str_frm_array = implode(" ",$array_name);
echo $str_frm_array;
?>
The output will be:
Today is Monday!