TreeviewCopyright © aleen42 all right reserved, powered by aleen42
黏合
implode — 将一个一维数组的值转化为字符串
语法
- string implode( string $glue, array $pieces)
- string implode( array $pieces)
描述
- 用 glue 将一维数组的值连接为一个字符串
- implode() 可以接收两种参数顺序
参数
参数 |
描述 |
glue |
默认为空的字符串 |
pieces |
你想要转换的数组 |
返回值
- 返回一个字符串,其内容为由 glue 分割开的数组的值
举例
$array = ['this','is','an','example'];
$result = implode(',',$array);
echo $result;
this,is,an,example
$array = ['this','is','an','example'];
$result = implode($array);
echo $result;
thisisanexample
join — 别名 implode()