The comma separated list can be created by using implode() function. The implode() is a builtin function in PHP and is used to join the elements of an array. implode() is an alias for PHP | join() function and works exactly same as that of join() function.
If we have an array of elements, we can use the implode() function to join them all to form one string. We basically join array elements with a string. Just like join() function , implode() function also returns a string formed from the elements of an array.
string implode( separator, array )
Return Type: The return type of implode() function is string. It will return the joined string formed from the elements of array.
Example 1: This example adds comma separator to the array elements.
Array (  => GFG1  => GFG2  => GFG3 ) GFG1, GFG2, GFG3
Array (  => 0  => 1  => 2  => 3  => 4  => 5  => 6  => 7 ) 0, 1, 2, 3, 4, 5, 6, 7
- How to Convert CSV to JSON file having Comma Separated values in Node.js ?
- Split a comma delimited string into an array in PHP
- How to create an array for JSON using PHP?
- How to create an array with key value pairs in PHP?
- How to create a string by joining the array elements using PHP ?
- Create an unordered list without any bullets using CSS
- How to create To-Do List using jQuery?
- How to create a To-Do list using Drag and Drop in Angular 7 ?
- How to Create Todo List in Angular 7 ?
- How to create a group of related options in a drop-down list using HTML ?
- How to create an unordered list in HTML ?
- How to create an ordered list using HTML5 ?
- Create a web server and run PHP script on it using Raspberry Pi
- How to create directory with HTML button and PHP ?
- How to create a copy of an object in PHP?
- How to create singleton design pattern in PHP 5 ?
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.