Implode and Explode in PHP

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

separatorIt’s optional parameters. By default set empty.
arrayRequired. 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

separatorIt’s is delimeter and required.
stringString, which you want to break
limitOptional. 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


My name is Devendra Dode. I am a full-stack developer, entrepreneur, and owner of I like writing tutorials and tips that can help other developers. I share tutorials of PHP, Python, Javascript, JQuery, Laravel, Livewire, Codeigniter, Node JS, Express JS, Vue JS, Angular JS, React Js, MySQL, MongoDB, REST APIs, Windows, Xampp, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL and Bootstrap from a starting stage. As well as demo example.

Leave a Reply

Your email address will not be published. Required fields are marked *