The join() function is built-in function in PHP and is used to join an array of elements which are separated by a string.
string join( $separator, $array)
Parameter: The join() function accepts two parameter out of which one is optional and one is mandatory.
- $separator : This is an optional parameter and is of string type. The values of the array will be join to form a string and will be separated by the $separator parameter provided here. This is optional, if not provided the default is “” (i.e. an empty string)
- $array : The array whose value is to be joined to form a string.
Return Type: The return type of join() function is string. It will return the joined string formed from the elements of $array.
Input : join(array('Geeks','for','Geeks') Output : GeeksforGeeks Input : join("-",array('Geeks','for','Geeks') Output : Geeks-for-Geeks
Below program illustrates the working of join() function in PHP:
- PHP | Ds\Set join() Function
- p5.js | join() function
- PHP | Ds\Vector join() Function
- PHP | Ds\Deque join() Function
- PHP | Ds\Sequence join() Function
- Node.js | join() function
- How to use .join() with push and replace together?
- Node.js | path.join() Method
- TypeScript | Array join() Method
- How to get the function name inside a function in PHP ?
- D3.js | d3.mean() function
- D3.js | d3.sum() function
- p5.js | tan() function
- PHP | Ds\Map xor() Function
- p5.js | int() function
- D3.js | d3.min() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.