Implode():

  • Using this method we can convert an array into string

example

 <?php
$array = array(‘lastname’, ’email’, ‘phone’);
$comma_separated = implode(“,”, $array);echo $comma_separated; // lastname,email,phone

?>

explode():

  • Using this method we can convert a string into array

example:

<?php
// Example 1
$pizza  = "piece1 piece2 piece3 piece4 piece5 piece6";
$pieces = explode(" ", $pizza);
echo $pieces[0]; // piece1
echo $pieces[1]; // piece2
?>