- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
implode() function in PHP
The implode() function is used to join array elements with a string.
Syntax
implode(separator, arr)
Parameters
separator − Specifies what to include between the array elements. The default is ""
arr − The array to join to a string
Return
The implode() function returns a string from elements of an array.
Example
The following is an example −
<?php $arr = array('This','is','Demo','Text!'); echo implode("$",$arr); ?>
Output
The following is the output −
This$is$Demo$text!
Example
The following is an example −
<?php $myarr = array('This','is','Demo','Text!'); echo implode("-",$myarr); echo implode("#",$myarr); ?>
Output
The following is the output −
This-is-Demo-Text!This#is#Demo#Text!
- Related Articles
- What is implode() function in PHP?
- strcmp() function in PHP
- strcoll() function in PHP
- strcspn() function in PHP
- strip_tags() function in PHP
- stripcslashes() function in PHP
- stripos() function in PHP()
- stristr() function in PHP
- stripslashes() function in PHP
- strlen() function in PHP
- strnatcasecmp() function in PHP
- strnatcmp() function in PHP
- strncasecmp() function in PHP
- strncmp() function in PHP
- strpbrk() function in PHP

Advertisements