- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- 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
join() function in PHP
The join() function is alias of implode(). It returns string from the elements of an array.
Syntax
join(separator, arr)
Parameters
separator − It specifies what to put between the array elements. The default is ""
arr − Array to join to a string
Return
The join() function returns a string from elements of an array.
Example
The following is an example −
<?php $arr = array('This','is','Demo','Text!'); echo join("$",$arr); ?>
Output
This$is$Demo$text!
Example
The following is an example −
<?php $myarr = array('This','is','Demo','Text!'); echo join("-",$myarr); echo join("#",$myarr); ?>
Output
This-is-Demo-Text!This#is#Demo#Text!
Advertisements