PHP join() Function

PHP join() Function

The join() function of PHP returns a string from the elements of an array. This function is an alias of the implode() function.

Syntax

join(separator,array)

Parameter

separator(Optional)- Specifies what to put between the array elements. The default value is empty string ("").

array(required)- This parameter represents the array to join to a string

Return

This function returns a string from the elements of an array.

Example 1

 

Output

Before the join() function...
array('This','is','a','PHP','Join','Function')
After the join() function...
This is a PHP Join Function 

Example 2

 

Output

Before the join() function...
array('This','is','a','PHP','Join','Function')
After the join() function...
This+is+a+PHP+Join+Function 

Example 3

   

Output

The special characters are: 
 !
 @
 #
 $
 %
 ^
 &
 *
 (
 }
 ~