Loading…

What is the difference between implode() and explode() in php?

explode() function breaks a string into an array, but the implode() function returns a series from the elements of an array.

Example : $arr = array("1","2","3","4","5");

$str = implode("-",$arr);

OUTPUT

1-2-3-4-5

 

$array2 = "My name is umesh";

$a = explode(" ",$array2 );

print_r ($a);

OUTPUT

$a = Array ("My", "name", "is", "umesh");

 

 

Suggest An Answer

No suggestions avaliable!

Latest post from PHP interview questions

Ask Question