Implode and Explode in PHP


Implode and explode function in PHP; Through this tutorial, we will show you everything about implode() and explode() function in PHP.

We can use both functions with PHP arrays and strings. And here also take examples like an array to string conversion in PHP, the string to array conversion in PHP.

Implode and Explode in PHP

  • PHP implode() Function
  • PHP Explode Function

PHP implode() Function

Implode function is a built-in function of php, which is used to convert array to string by provided delimiter.



Parameters of implode function

Parameter Description
separator It’s optional parameters. By default set empty.
array Required. The array to join to a string

Example:- array to string conversion in php

$array = array('1','2','3','4','5');
echo implode(" ", $array);



PHP Explode Function

Explode function is a built-in function of php, which is used to convert/break string to an array by a provided delimiter.



Parameters of explode function

Parameter Description
separator It’s is delimeter and required.
string String, which you want to break
limit Optional. Specifies the number of array elements to return.

Example:- string to array conversion in php

$string = "1,2,3,4,5";
print_r(explode(",", $string));


Array ([0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5)

Recommended PHP Tutorials

  1. Compare Arrays PHP | PHP array_diff() Function
  2. Get, Write, Read, Load, JSON File from Url PHP
  3. Functions: Remove First Character From String PHP
  4. Remove Specific/Special Characters From String In PHP
  5. How to Replace First and Last Character From String PHP
  6. Reverse String in PHP
  7. Array Push, POP PHP | PHP Array Tutorial
  8. PHP Search Multidimensional Array By key, value and return key
  9. json_encode()- Convert Array To JSON | Object To JSON PHP
  10. PHP remove duplicates from multidimensional array
  11. PHP Remove Duplicate Elements or Values from Array PHP
  12. Get Highest Value in Multidimensional Array PHP
  13. PHP Get Min or Minimum Value in Array
  14. String PHP to Uppercase, Lowercase & First Letter Uppercase
  15. PHP: isset() vs empty() vs is_null()
  16. Chunk_split PHP Function Example
  17. PHP Function: Date and Time With Examples
  18. Reverse Number in PHP | PHP Tutorial


Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.


Jassweb, Rai Chak, Punjab, India. 143518
Item added to cart.
0 items - 0.00