Saturday, 27 September 2014

join in PHP

PHP join() function is utilized to add all element of given array into single string variable.
PHP join function is an alias to implode() function.
PHP join function woks similar to implode() function.

Syntax:

join(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 = join(" ",$array_name);
echo $str_frm_array;
?>
O/P:
Today is Monday!



0 comments:

Post a Comment