在PHP中串接空格之间的最佳方式 [英] Best Way To Concatenate Strings In PHP With Spaces In Between
本文介绍了在PHP中串接空格之间的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要连接不确定数目的字符串,并且我想在两个相邻的字符串之间留一个空格。像这样 abcdef
。
I need to concatenate an indeterminate number of strings, and I would like a space in between two adjoining strings. Like so a b c d e f
.
我也不想要任何前导或尾随空格,最好的方法是什么
Also I do not want any leading or trailing spaces, what is the best way to do this in PHP?
推荐答案
您的意思是 $ str = implode('',array('a' ,'b','c','d','e','f')));
?
这篇关于在PHP中串接空格之间的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文