Heim  >  Artikel  >  Backend-Entwicklung  >  PHP函数implode()与explode()函数的不同之处_PHP教程

PHP函数implode()与explode()函数的不同之处_PHP教程

WBOY
WBOYOriginal
2016-07-15 13:30:23831Durchsuche

在以前的文章中我们曾经向大家介绍了explode() 函数的具体用法。当我们遇到PHP函数implode()把数组元素组合为一个字符串。
implode(separator,array)
separator 可选。规定数组元素之间放置的内容。默认是 ""(空字符串)。
array 必需。要结合为字符串的数组。
虽然 separator 参数是可选的。但是为了向后兼容,推荐您使用使用两个参数。


PHP函数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>
</li>
</ol>

输出:

Hello World! Beautiful Day!

上面这段代码示例就是PHP函数implode()的具体实现功能的展现。


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/446300.htmlTechArticle在以前的文章中我们曾经向大家介绍了explode() 函数的具体用法。当我们遇到 PHP函数implode()把数组元素组合为一个字符串。 implode(separator,...
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn