what are Implode and Explode functions?

Answer Posted / puneet bhatt

explode function:-it breaks a string into array.
<?php
$str="hello world.it's a beautiful day.":
print_r(explode(" ",$str):
?>
ans-ARRAY
[0]=>hello
[1]=>world.
[2]=>it's
[3]=>a
[4]=>beautiful
[5]=>day.

implode:-returns a string from elements of an array.
<?php
$arr=array('hello','world!',beautiful,'day!');
echo implode(" ",$arr);
?>
ans-hello world! beautiful day!

Is This Answer Correct ?    36 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the different components used in php for formatting?

529


What is an anti csrf token?

496


Explain me how failures in execution are handled with include() and require() functions?

604


What is the difference between $var and $$var?

548


Is empty array php?

538






What is the use of count() function in php?

524


What are php expressions?

593


How can I convert ereg expressions to preg in php?

474


Explain me is it possible to destroy a cookie?

553


What is a collection in php?

513


What is encapsulation in php?

556


How to enable parsing?

611


Explain how to execute a php script using command line.

556


What is the phpstorm?

522


How do you display the output directly to the browser?

464