The difference between PHP function implode() and explode() function_PHP tutorial

WBOY
Release: 2016-07-15 13:30:23
Original
840 people have browsed it

In previous articles, we have introduced you to the specific usage of the explode() function. When we encounter the PHP function implode() combines the array elements into a string.
implode(separator,array)
separator optional. Specifies what is placed between array elements. Default is "" (empty string).
array required. Arrays to be combined into strings.
Although the separator parameter is optional. However, for backward compatibility, it is recommended that you use two parameters.


Example of PHP function implode()

<ol class="dp-xml"><li class="alt"><span><span class="tag"><?</span><span class="tag-name">php</span><span> </span></span></li><li><span>$</span><span class="attribute">arr</span><span> = </span><span class="attribute-value">array</span><span>('Hello','World!','Beautiful','Day!');  </span></li><li class="alt"><span>echo implode(" ",$arr);  </span></li><li><span class="tag">?></span><span> </span></span></li></ol>
Copy after login

Output:

Hello World! Beautiful Day!

The above code example is a demonstration of the specific implementation function of the PHP function implode().


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446300.htmlTechArticleIn previous articles, we have introduced to you the specific usage of the explode() function. When we encounter the PHP function implode(), it combines array elements into a string. implode(separator,...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!