1.结论
explode

explode( string $delimiter, string $string[, int $limit = PHP_INT_MAX] ) : array
分割字符串到数组

implode
数组元素组合为一个字符串
implode( string $glue, array $pieces) : string
implode( array $pieces) : string

2.实例
前提:
(1)本地机器安装XAMPP,下载地址如下
https://www.apachefriends.org/index.html

(2)启动Apache
PHP explode 字符串→数组 implode数组→字符串

explode

PHP explode 字符串→数组 implode数组→字符串

<?php $str='one,two,three,four'; $parts=explode(',',$str); print_r ($parts); ?>

PHP explode 字符串→数组 implode数组→字符串

implode
PHP explode 字符串→数组 implode数组→字符串

<?php $pieces=['2020','01','11']; print implode('-',$pieces); ?>

PHP explode 字符串→数组 implode数组→字符串

相关文章: